1. Docker RUN start the container when the container is created when a command;
docker exec is the start operation for already created a container;
2. Exec -i : --interactive (interaction) Keep STDIN open even if not attached ( even if not connected, but also to maintain open STDIN);
-t Exec: --tty the Allocate A pseudo-the TTY (assigned a pseudo terminal);
If only -i, since the dummy terminal is not allocated, perform the same pipe looks like. But the results of each command can get the correct return value, plus -t have a console interface, better interactivity.
If only -t parameter, you can see a console window, but will execute the command found due to the output did not get stdin can not see the command execution.
3. -attach terminal to enter commands directly into the container already exists, and will not start a new process, if you exit, it will terminate the entire docke process r container.
-exec is open in the new container terminal, and can start a new process to exit will not affect the docker container process.
-Exec more general parameters used.
4. When the time to enter the exec docker container, enter "Exit" ( the Ctrl + D ) or key "Ctrl + C" when exiting the container, the container is still running in the background.
5 docker run
: a container starting from the mirror, i.e., to create a new container.
docker start
: Run stopped container.
tips:
Parameter ①-d
The implementation of a process in the background. As can be seen, if the process takes a long time a command, use the -d parameter will return soon.
Running in the background.
② view the mapping information docker container port
docker container port container_name