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.
- Docker installed
- Docker compose is installed
Create a project and place it in the root of the project
docker-compose.ymlas well as
nginx.conf. Among them,
nginx.confIt’s the nginx file you need to test,
docker-compose.ymlIs 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 implementation
docker-compose upYou can start the container and show the running effect of the container
At this point, you can visit
localhost:8080To see your own configuration.