Skip to content

Instantly share code, notes, and snippets.

@pradp
Last active April 3, 2017 12:29
Show Gist options
  • Save pradp/300350850d3f60f7abfbc739af1916c7 to your computer and use it in GitHub Desktop.
Save pradp/300350850d3f60f7abfbc739af1916c7 to your computer and use it in GitHub Desktop.
Docker commands
To override the entry point for any of the docker images. In the vertx image you can first avoid executing vertx and bash in to the container and then execute later
docker run -it --entrypoint=/bin/bash vertx/vertx3-exec
--rm removes the image as soon as you exit the container. Clean!!!
docker run -it --rm --entrypoint=/bin/bash vertx/vertx3-exec
View running processes
$ sudo docker ps
View all processes
$ sudo docker ps -a
Run an image in a new container daemonized
$ sudo docker run -d <image_name>
Run an image in interactive mode with the command /bin/bash
$ sudo docker run -i -t <image_name> /bin/bash
Run an image in interactive mode with the command /bin/bash and link the ports.
$ sudo docker run -i -t --link <docker_container_name>:<docker_container_alias> <image_name> /bin/bash
Run an image with an ENTRYPOINT command in interactive mode with the command /bin/bash
$ sudo docker run --entrypoint /bin/bash -i -t <image_name>
Run an image in interactive mode with the command /bin/bash mounting the host director /var/app/current to the container directory /usr/src/app
$ sudo docker run -i -t -v /var/app/current:/usr/src/app/ <image_name> /bin/bash
Run an image in interactive mode with the command /bin/bash setting the environments variables FOO and BAR
$ sudo docker run -i -t -e FOO=foo -e BAR=bar <image_name> /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment