Use docker compose the

 

After the introduction to installation docker-compose the line, we simply use the next docker-compose

For example with nginx

We create folders mkdir /usr.local/docker/nginx

Yml create a file format in the nginx folder and add the following in the file

vi Docker-compose.yml

 


 

Add the following, do not understand the format of the document yml can go to learn to write his document format, there is not much to say, very simple

 

version: '3.3'

services:

  nginx:

    restart: always

    image: nginx

    container_name: nginx

    ports:

       -80:80

 


 

Start this file 

docker-compose up


 

The way and then look to open the browser is correct

 


 

Description mirroring success

Then we want him to delete NA docker rm but the use of docker-compose down

Before this state is deleted

 


 

After docker-compose down

 


 

Container no longer exists

Guess you like

Origin www.cnblogs.com/gaozhanghappy/p/10955212.html