How docker starts image

王林
Release: 2020-03-24 15:18:13
Original
6264 people have browsed it

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
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!