Skip to content

Instantly share code, notes, and snippets.

@davidalbertonogueira
Created October 22, 2018 09:45
Show Gist options
  • Save davidalbertonogueira/950777ec5f7f87305e8eb6dfe3c1f715 to your computer and use it in GitHub Desktop.
Save davidalbertonogueira/950777ec5f7f87305e8eb6dfe3c1f715 to your computer and use it in GitHub Desktop.
Docker commands
docker build -t myapp:2.0 .
docker run --name myapp_2.0 -d -p 7777:7000 myapp:2.0
docker run --name myapp_2.0 -it -p 7777:7000 myapp:2.0
## -it is short for --interactive + --tty when you docker run with this command.
## it would take you straight inside of the container,
## where -d is short for --detach which means you just run the container and
## then detach from it so basically you run container in the background.
## edit : so if you run docker container with -itd it would run the-it options and detach you from the container,
## so your container still running in the background even without any default app to run.
docker kill myapp_2.0
docker rm myapp_2.0
docker run --name myapp_2.0 -d -p 7777:7000 myapp:2.0
## docker run --rm -p ... would prevent requiring docker rm previously
docker run --rm -p 4000:5000 -p 4001:5001 -p 4002:30001 -v /user/bigdata:/user/bigdata/ my_app:2.0
## -v is used to map folder outside docker to a path inside it.
## Good for config files, or huge datasets, indexs or models that shouldn't be inside the docker.
## -p <port host machine>:<port inside docker to expose>
docker run -it myapp:2.0 bash
## opens bash inside container
docker tag myapp:2.0 <target account on dockerhub>/myapp:2.0
## tag
docker push <target account on dockerhub>/myapp:2.0
## upload
docker ps
docker images | grep myapp
docker run --rm -ti --name=ctop -v /var/run/docker.sock:/var/run/docker.sock quay.io/vektorlab/ctop:latest
#ctop for dockers
vim docker-compose.yml
docker-compose build
docker-compose up
docker-compose up --build -d
docker-compose down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment