Running a container in Docker ----------------------------- To run a container you can simply type: .. code-block:: shell $docker run Some of the flags available are the following: +------------------------------------------+---------------------------------------------------+ | Flag | Effect | +==========================================+===================================================+ | | -i | | Attaches the stdout and stdin to the container. | +------------------------------------------+---------------------------------------------------+ | | -t | | Creates a fake tty for the container. | +------------------------------------------+---------------------------------------------------+ | | \\-\\-rm | | Removes the image as soon as it is exited. | +------------------------------------------+---------------------------------------------------+ | | \\-\\-name | | Gives the container a name to be used as a | | | | reference when managing. If not provided, | | | | Docker will give it a random unique name. | +------------------------------------------+---------------------------------------------------+ | | -d | | Detaches the input and output of the container | | | | so as not to exit the container on exit. | +------------------------------------------+---------------------------------------------------+ | | -p : | | Attaches the port to the | | | | port on the container itself. | +------------------------------------------+---------------------------------------------------+ | | -P | | Attaches a random external port to the | | | | internal port on the container itself. | +------------------------------------------+---------------------------------------------------+ | | -e = | | Changes the environment variable to the | | | | value inside the container. | +------------------------------------------+---------------------------------------------------+ | | \\-\\-mount \\-\\-type=bound,source= | | Mounts the local filesytem directory | | | ,target= | | to the container's directory. It is | | | | | required that no space is given after commas. | +------------------------------------------+---------------------------------------------------+ | | \\-\\-restart | | The restart policy can take on 4 values, being | | | | | "no", "on-failure", "unless-stopped", "always". | | | | | To restart after reboot, use "unless-stopped". | +------------------------------------------+---------------------------------------------------+ For more advanced commands refer to the official Docker documentation_. .. _documentation: https://docs.docker.com/engine/reference/commandline/run