Container technology is widely used in various scenarios, in the actual application process, we can also according to their own needs, various configurations. Recently, because I was debugging nginx, I also used docker to debug nginx.
Requirements
- Docker installed
- Docker compose is installed
Realization idea
Docker compose can help us simplify the configuration of some docker startup. By writing configuration files, we can simplify the command to start the container.
Specific operation
Create a project and place it in the root of the projectdocker-compose.yml
as well asnginx.conf
. Among them,nginx.conf
It’s the nginx file you need to test,docker-compose.yml
Is used to record your docker container startup configuration.
Start the container and test the effect
Place the content of the profile you need to test in the nginx.conf And in docker- compose.yml Add the following to the
web:
image: nginx
ports:
- "8080:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
command: [nginx-debug, '-g', 'daemon off;']
Then, the implementationdocker-compose up
You can start the container and show the running effect of the container
At this point, you can visitlocalhost:8080
To see your own configuration.