Home >Operation and Maintenance >Docker >How docker starts image

How docker starts image

王林
王林Original
2020-03-24 15:18:136578browse

How docker starts image

Method 1: Execute docker run command to start

For example:

docker run -it --env-file ./run/hrms.env -v /opt/hrms/hrms/hrms:/opt/hrms/hrms -p 10.142.8.12:8083:8080 55

Parameter introduction:

–env-file means to load environment variables from a file. The file format is key=value, one variable per line.

-v means to mount the file on the host into the image. The colon in front of it means the host file path. The latter represents the image file path, and the absolute path

-p represents mapping the 8080 port in the image to the 8083 port on the host. 10.142.8.12 represents the host ip

Method 2: docker-compose startup

docker-compose is one of the three swordsmen of docker. It is a plug-in used to specifically start the image. It can be installed through pip install docker-compose.

You can create a new folder with the following directory structure as the startup folder of the image:

Write the docker-compose.yml file:

How docker starts image

Startup:

Switch to the directory where docker-compose.yml is located and execute the following command to start the image.

docker-compose up

Recommended related tutorials: docker tutorial

The above is the detailed content of How docker starts image. 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