Home>Article>Operation and Maintenance> What command to use to run docker container

What command to use to run docker container

WBOY
WBOY Original
2021-12-30 09:59:37 54719browse

The command to run a container in docker is "docker run option image name"; the function of the run command is to create and run a container. A container can only be created if there is an image. The parameter image name can also be replaced by the image ID. When When the "-d" parameter is added to the run command, the container will be run in the background and the container ID will be returned.

What command to use to run docker container

The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.

What command is used to run a docker container

docker run: Create a new container and run a command

The syntax is as follows :

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Among them, the image name can also be replaced by the image ID,

The most commonly used option

  • -i: In interactive mode Run the container, usually used together with -t,

  • -t: Reassign a pseudo input terminal, that is, tty, to the container, usually used together with -i,

  • --name: Specify a new running name for the container,

  • -d: Run the container in the background and return the container ID, that is, start the daemon Containers, docker containers running in the background, must have a foreground process

What command to use to run docker container

What command to use to run docker container

##You can see that by executing the command After that, you enter the root directory of docker's centos system. The host name underlined in red is the container ID of the running centos.

Recommended learning: "

docker video tutorial"

The above is the detailed content of What command to use to run docker container. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn