#cloud-config
package_update: true
package_upgrade: true
packages: - apt-transport-https - ca-certificates - curl - gnupg - lsb-release runcmd: - apt-get update -y - apt-get install -y docker.io - systemctl enable docker - systemctl start docker - usermod -aG docker azureuser
#cloud-config
package_update: true
package_upgrade: true
packages: - apt-transport-https - ca-certificates - curl - gnupg - lsb-release runcmd: - apt-get update -y - apt-get install -y docker.io - systemctl enable docker - systemctl start docker - usermod -aG docker azureuser
#cloud-config
package_update: true
package_upgrade: true
packages: - apt-transport-https - ca-certificates - curl - gnupg - lsb-release runcmd: - apt-get update -y - apt-get install -y docker.io - systemctl enable docker - systemctl start docker - usermod -aG docker azureuser
sudo cat /var/log/cloud-init-output.log | grep -i docker
sudo cat /var/log/cloud-init-output.log | grep -i docker
sudo cat /var/log/cloud-init-output.log | grep -i docker
chmod 400 docker-vm_key.pem
ssh -i docker-vm_key.pem [email protected]
chmod 400 docker-vm_key.pem
ssh -i docker-vm_key.pem [email protected]
chmod 400 docker-vm_key.pem
ssh -i docker-vm_key.pem [email protected]
docker --version
# Docker version 29.1.3 docker ps
# Empty, no containers yet. But Docker is alive.
docker --version
# Docker version 29.1.3 docker ps
# Empty, no containers yet. But Docker is alive.
docker --version
# Docker version 29.1.3 docker ps
# Empty, no containers yet. But Docker is alive.
git clone https://github.com/pravinmishraaws/Azure-Static-Website.git
cd Azure-Static-Website
ls
# README.md index.html
git clone https://github.com/pravinmishraaws/Azure-Static-Website.git
cd Azure-Static-Website
ls
# README.md index.html
git clone https://github.com/pravinmishraaws/Azure-Static-Website.git
cd Azure-Static-Website
ls
# README.md index.html
FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/*
COPY . /usr/share/nginx/html
EXPOSE 80
FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/*
COPY . /usr/share/nginx/html
EXPOSE 80
FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/*
COPY . /usr/share/nginx/html
EXPOSE 80
docker build -t static-site:latest .
docker build -t static-site:latest .
docker build -t static-site:latest .
docker run -d --name static-site \ -p 80:80 \ --restart unless-stopped \ static-site:latest
docker run -d --name static-site \ -p 80:80 \ --restart unless-stopped \ static-site:latest
docker run -d --name static-site \ -p 80:80 \ --restart unless-stopped \ static-site:latest
CONTAINER ID IMAGE PORTS NAMES
83cb16a6cb44 static-site:latest 0.0.0.0:80->80/tcp static-site
CONTAINER ID IMAGE PORTS NAMES
83cb16a6cb44 static-site:latest 0.0.0.0:80->80/tcp static-site
CONTAINER ID IMAGE PORTS NAMES
83cb16a6cb44 static-site:latest 0.0.0.0:80->80/tcp static-site - 1 Linux VM on Azure (Ubuntu 24.04 LTS, Standard D2lds v6)
- A cloud-init script that installed Docker automatically on first boot
- A Dockerized static website served by Nginx
- A live URL accessible from anywhere in the world - -d runs the container in the background
- --name static-site gives it a friendly name
- -p 80:80 maps port 80 on the VM to port 80 inside the container
- --restart unless-stopped means it comes back automatically after a VM reboot