# nginx nginx_test: container_name: "nginx_test" image: "nginx" tty: true # command: nginx command: nginx -g "daemon off;"
If configured as noted, the container will always be in the existing state.
nginx_test exited with code 1
1 official image downloaded.
2 Use the docker inspect command to see that the default command is command: nginx -g “daemon off; ” , so you can leave command configuration blank.
But my question is, why must DAEMON OFF be added for NGINX container to function normally?
Are you downloading an official image?
If it is an official image, you do not need to use command, and the container starts successfully, i.e. nginx starts successfully.