Skip to content

Instantly share code, notes, and snippets.

@tuanngominh
Last active September 17, 2019 03:32
Show Gist options
  • Save tuanngominh/1d75253c5a56e0335af7e44a7514f58c to your computer and use it in GitHub Desktop.
Save tuanngominh/1d75253c5a56e0335af7e44a7514f58c to your computer and use it in GitHub Desktop.
docker, docker composer cheatseat

Build, start, run all services https://docs.docker.com/compose/reference/up/

docker-compose up -d --build

Run command agaist a service https://docs.docker.com/compose/reference/run/

docker-compose run service1 service1-command-detail-here service1-command-param

django

docker-compose run server ./manage.py migrate
docker-compose run server ./manage.py createsuperuser

install new package using pip update requirements.txt with new package run again

docker-compose up -d --build

Debug

ssh to docker

  • Pull docker image docker pull gcr.io/gcp-project-name-1/service-name-1
  • List all available images docker images
  • Run an image with shell script docker run -it --entrypoint /bin/bash gcr.io/gcp-project-name-1/service-name-1

Set environment variables

in Dockerfile

ENV ENV1=value1
RUN ./manage.py collectstatic --noinput
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment