Containers¶
Getting started with containers is easy! Follow along and ask questions, we're here to help.
Outcomes¶
You should be able to:
- Understand the install and use a docker runtime and client
- Containerize an application
Outline¶
-
Install Docker
The best way, on Linux nodes, is to use the script:
curl -fsSL get.docker.com -o get-docker.sh && sudo sh get-docker.sh && sudo systemctl start docker && sudo systemctl enable docker
Don't forget to add your user to the docker group:
sudo usermod -aG docker $USER
You'll need to logout and login again for the group change to take effect.
-
Run a container
docker run busybox echo Hello World
What just happened?
- The docker client contacted the docker daemon process
- The docker daemon pulled the "busybox" image from the docker hub
- The docker daemon created a new container from that image which runs the executable that produces the output you are currently reading
- The docker daemon streamed that output to the docker client, which sent it to your terminal
- The docker daemon then exited
- The docker client exited
- The container was destroyed
-
Run a container in the background
docker run -d -p 80:80 nginx
Connect to the nginx container:
curl localhost
-
Run a container in the background
docker run -d -p 80:80 nginx