diff --git a/slides.md b/slides.md index 430392f..2c0881f 100644 --- a/slides.md +++ b/slides.md @@ -175,6 +175,147 @@ transition: fade-out ## Containers are just processes -If you don't take anything else away from this talk, I hope you walk away with a better understanding of this fundamental. As far as the OS is concerned, a container is just another process/set of processes to the operating system. +If you don't take anything else away from this talk, I hope you walk away with a better understanding of this fundamental. As far as the OS* is concerned, a container is just another process/set of processes to the operating system. + +
+
+
+
+
+
+
+ +

*This is only strictly true on Linux. Running Docker on Mac/Windows requires Docker Desktop which actually creates and manages a Linux VM. Your containers actually run inside of this VM.

+--- +transition: fade-out +layout: two-cols-header +--- +# Let's get started + +::left:: +## Windows/Mac +Install Docker Desktop from: https://docs.docker.com/desktop/ + +::right:: +## Linux +Find installation instructions for Docker Engine here: https://docs.docker.com/engine/install/ubuntu/ + +--- +transition: fade-out +--- +# Running our first container + +## First run the container + +We are running an nginx webserver container in daemon (background mode). We are forwarding connections from localhost:8088 to port 80 *inside* the container. This is the default port that nginx is running on. +````md magic-move +```shell +$ docker run --rm -p 8088:80 --name nginx-container -d nginx:alpine +``` +```shell +$ docker run --rm -p 8088:80 --name nginx-container -d nginx:alpine +cd4302edce965beb95fdb9ecb19ff7432758f1e505d792e368fd401ea9abab65 +``` +```shell +$ docker container ps +``` +```shell +$ docker container ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +cd4302edce96 nginx:alpine "/docker-entrypoint.…" 15 seconds ago Up 14 seconds 0.0.0.0:8088->80/tcp, [::]:8088->80/tcp nginx-container +``` +```` + +# Now run docker container ps to list running containers + + +
+--- +transition: fade-out --- +## View the logs for our container +````md magic-move + +```shell +$ docker container logs --follow nginx-container +``` + + +```shell +$ docker container logs --follow nginx-container +/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration +/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ +/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh +10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf +10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf +/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh +/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh +/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh +/docker-entrypoint.sh: Configuration complete; ready for start up +2025/04/30 23:02:32 [notice] 1#1: using the "epoll" event method +2025/04/30 23:02:32 [notice] 1#1: nginx/1.27.5 +2025/04/30 23:02:32 [notice] 1#1: built by gcc 14.2.0 (Alpine 14.2.0) +2025/04/30 23:02:32 [notice] 1#1: OS: Linux 6.12.10-76061203-generic +2025/04/30 23:02:32 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1024:524288 +2025/04/30 23:02:32 [notice] 1#1: start worker processes +2025/04/30 23:02:32 [notice] 1#1: start worker process 30 +2025/04/30 23:02:32 [notice] 1#1: start worker process 31 +2025/04/30 23:02:32 [notice] 1#1: start worker process 32 +2025/04/30 23:02:32 [notice] 1#1: start worker process 33 +2025/04/30 23:02:32 [notice] 1#1: start worker process 34 +2025/04/30 23:02:32 [notice] 1#1: start worker process 35 +2025/04/30 23:02:32 [notice] 1#1: start worker process 36 +2025/04/30 23:02:32 [notice] 1#1: start worker process 37 + +``` +```` + +--- +transition: fade-out +--- + +## Interacting with our container + +Now let's try interacting with the Nginx server. By default it should serve a default page. + +````md magic-move + +```shell +# Hitting Ctrl+Z on Linux will put our logs process into the background + +$ ^Z +``` +```shell +$ ^Z + +[1]+ Stopped docker container logs --follow nginx-container +``` +```shell +# Now send a curl request to localhost:8080. This should be forwarded to port 80 in our container +$ curl localhost:8088 + + + +Welcome to nginx! + + + +

Welcome to nginx!

+

If you see this page, the nginx web server is successfully installed and +working. Further configuration is required.

+ +

For online documentation and support please refer to +nginx.org.
+Commercial support is available at +nginx.com.

+ +

Thank you for using nginx.

+ + +``` +````