The docker run command starts a process in a container. Commonly, the process is a bash shell that allows you to attach to the container and start other processes. This command returns a hash value that defines this session.
When a Docker container starts, a network connection is created for it automatically.
The syntax for the run command is as follows:
docker run [OPTIONS] CONTAINER COMMAND
The docker run command supports many options, including:
- -t: Allocate a pseudo tty (by default, false)
- -i: Keep an interactive session open while unattached
- -d: Start the container detached (running in the background)
- --name: The name to assign to this instance
This example starts the bash shell in the container that was previously pulled:
# docker run -t -i -d --name leph1 lephare/apache /bin/bash
1d862d7552bcaadf5311c96d439378617d85593843131ad499...