Deploy a public image

A deployment describes the containers that run on the service: the image, the open ports and which container receives the traffic of the public domain. Each time you save a deployment, Lightsail creates a new version.

  1. When the service is Ready, open the Deployments tab and choose Create your first deployment.

Create the first deployment

  1. Fill in the container:
    • Container name: web
    • Image: nginx:stable-alpine. Without a registry name, Lightsail pulls the image from Docker Hub.
    • Choose Add open ports, enter 80 and keep HTTP.

Container settings

  1. Under Public endpoint, choose web. The port is 80 and the health check path is /. Lightsail sends the traffic of the public domain to this container and checks it on this path. Choose Save and deploy.

Public endpoint

  1. The status changes to Deploying (version 1). It takes about 3–5 minutes before it becomes Running.

Deploying

  1. Open the Public domain in your browser. You see the page Welcome to nginx!. You can also check it from CloudShell:
URL=$(aws lightsail get-container-services --region ap-southeast-1 \
  --service-name fcj-container --query 'containerServices[0].url' --output text)
echo $URL
curl -s $URL | grep -E '<title>|<h1>'

nginx response