Docker is an engine to run containers from a Windows or Linux command line. A container is simlar to a VMware image or a template. Most containers already have an application installed but you can also use base OS images to build your own application. In this exercise we will deploy a container image with a pre-built web server running a simple web page.
- A Machine Running Docker see my guide here
By default, Docker is not running in a new Photon OS VM, type the following and see
Type the command again and see that Docker is running but there are no containers on the system yet
That command only started docker in this session, run the following so that docker starts every time you power on this Photon VM
systemctl enable docker
There are no images so use the following command to pull one
docker pull public.ecr.aws/m0z6y2h1/nginx:latest
Run the image as a container with the following command
docker run -d -p 80:80 public.ecr.aws/m0z6y2h1/nginx:latest
Now open a web browser to the ip address of your photon VM. NOTE: it is the same address you are using to SSH to the Photon VM
Yay. you successfully deployed your first Web Server Container! Add that to your resume!
To stop the container get the Container ID with the following command and copy it to the clipboard
Type the following command with the container ID you copied earlier
docker stop b814e20c60e3
Pingback: Containers – 101 – Pre-Work | VMtoCloud.com
Hey Ryan – you need to change step 4 to ‘systemctl enable docker’
Ahh, nice catch Tom, thank you and updated!
Pingback: Containers 101 – Create a Contaner with Docker | VMtoCloud.com