User Tools

Site Tools


docker_run

Docker Run Command

Flag Explanation
-i Interactive Container
-t creates a pseudo-TTY that attaches stdin and stdout
–rm Remove the container after the command/script has finished
-v adds a volume to the container
-d tells Docker to run the container in the background
-P automatically map any network port inside the container to a random high port within an ephemeral port range on your Docker host
-p e.g. -p 80:5000 binds the container to a specific port. This would map port 5000 inside our container to port 80 on our local host
-h

networking source http://docs.docker.com/userguide/dockerlinks/

Example Run with Mounted Volume

docker run -it -v /home/luke/documents:/location/on/container imageID

Example Run MountedVolume&SpecifiedPort

docker run -it -p 80:8081 -v /home/luke/documents:/location/on/container imageID



docker_run.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1