08 Run as deamon
To run as a service, follow the steps
- To run the container as a service run
docker-compose up -d
- To see the container running run
docker ps
ubuntu@student-0:~/ops2devops/3.Docker$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c5917fd155cc 3docker_webserver "/docker-entrypoint.…" 2 minutes ago Up 3 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp nginx
- Note the name if the container, is
nginx, and not random generated one. - open a browser to
http://studentip:80and see it’s still runnning as before. - Open
index.htmland change<p>When it's running thru Dockerfile!</p>to<p>When it's running thru Docker-Compose!</p>. - Save the file and refresh the website, and see your changes.
- Note the data is not build into the container, but instead directly mounted from the html directory, unlike the
web:v1andweb:v2we build earlier.