Docker CE
Overview
Docker Engine is the open source container runtime. This image has it fully installed and configured from the official Docker package repository, so you can run containers as soon as you connect.
What you get:
- Docker Engine, the Docker command-line client, the containerd runtime, the Buildx build plugin and the Compose plugin, all in place. The Docker daemon and containerd start automatically at boot.
- A separate, independently resizable storage volume mounted at the Docker data directory. Container image layers, container writable layers and named volumes live there, which keeps the container store off the operating system disk and lets you grow it without disturbing the rest of the instance.
- A one-shot service that runs on the first boot of every deployed instance and adds the default login user to the docker group. After a single re-login, you can manage containers without sudo.
- A short information file at
/stage/scripts/docker-info.logthat records the installed engine version and how container access is granted. It contains no secrets, because Docker has no daemon-level credentials to rotate. Linux group membership alone governs access to the container socket.
Prerequisites
Before you deploy this image, you need:
- An Amazon Web Services account where you can launch EC2 instances.
- IAM permissions to launch instances, create security groups, and subscribe to AWS Marketplace products.
- An EC2 key pair in the target Region for SSH access to the instance.
- A VPC and subnet in the target Region, with a security group that allows inbound port 22 from your management network.
- AWS CLI version 2 installed locally, if you plan to deploy from the command line.
Launch the instance from the AWS Marketplace
Sign in to the AWS Management Console, open the EC2 service, and select Launch instance. Under Application and OS Images, choose AWS Marketplace AMIs and search for Docker Engine.
Select the SecureAnyCloud listing and choose Select, then Continue on the subscription summary.
Pick an instance type of m5.large or larger as a balanced default, and size it to the container workload you intend to run. Choose your EC2 key pair under Key pair (login).
Under Network settings, select your VPC and subnet. Create or select a security group that allows inbound port 22 from your management network. If you plan to publish a containerized service, also open the port that service listens on. Leave the root volume at the default size or larger.
Select Launch instance. First-boot initialisation takes only a few seconds after the instance state becomes Running and the status checks pass.
Launch the instance from the AWS CLI
The following command launches an instance from the SecureAnyCloud Docker Engine Marketplace AMI into an existing subnet and security group. Replace <ami-id> with the AMI ID shown on the Marketplace listing, and <key-name> with your EC2 key pair name.
Replace <subnet-id> with your subnet ID, and <security-group-id> with a security group that opens port 22 from your management network.
aws ec2 run-instances \
--image-id <ami-id> \
--instance-type m5.large \
--key-name <key-name> \
--subnet-id <subnet-id> \
--security-group-ids <security-group-id> \
--block-device-mappings '{"DeviceName":"/dev/sda1","Ebs":{"VolumeSize":30,"VolumeType":"gp3"}}' \
--metadata-options 'HttpTokens=required,HttpEndpoint=enabled' \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=docker-engine}]'The image attaches a dedicated 20 GiB container storage volume automatically, mounted at the Docker data directory.
To start with more container storage, enlarge that volume on the Storage step in the console, or add a second block device mapping on the CLI.
Connect to the instance over SSH
Connect to the instance with SSH as the default login user for the operating system variant you launched. The login user differs by variant:
Operating system variant SSH login user
Ubuntu 24.04 ubuntu
Replace <key-file> with the path to your private key file and <instance-public-ip> with the public IP address or DNS name of the instance.
ssh -i <key-file> ubuntu@<instance-public-ip>The login user is added to the docker group on the instance's first boot. If you connect during the first few seconds after launch, log out and reconnect once so that your shell session picks up the new group membership. After that, the docker commands below run without sudo.
Confirm the Docker Engine
Check the installed engine, the API version and the runtime components. The client and server versions match, and the server reports the containerd and runc runtime versions.
docker versionConfirm the Buildx and Compose plugins and the containerd runtime are present:
docker compose version
docker buildx version containerd --versionRead the information file. It records the installed engine version and how container access is granted, and it holds no secrets:
cat /stage/scripts/docker-info.logRun your first container
Run the hello-world image. Docker pulls the image from Docker Hub, creates a container from it, runs it, and prints a confirmation message. This is the quickest end-to-end check that the engine works.
docker run hello-worldRun a longer-lived container in the background. The following command starts an nginx web server, names the container web, and publishes container port 80 on host port 8080:
docker run -d --name web -p 8080:80 nginx:alpineList the running containers and confirm the port mapping:
docker psDefine a multi-container application with Compose
The Compose plugin runs multi-container applications from a single declarative file. Create a working directory and a compose.yaml file that describes the services. The example below defines one nginx web service that publishes host port 8080.
mkdir -p ~/web-demo && cd ~/web-demo cat > compose.yaml <<'EOF' services: web: image: nginx:alpine ports: - "8080:80" restart: unless-stopped EOFBring the application up in the background with docker compose up -d. Then list its services with docker compose ps. Compose creates a dedicated network for the application and starts each service as a container.
To stop the application and remove its containers and network, run docker compose down from the same directory.
Build an image
Docker builds images from a Dockerfile. Create a small build context and a Dockerfile, then build a tagged image with docker build:
mkdir -p ~/build-demo && cd ~/build-demo cat > Dockerfile <<'EOF' FROM alpine:3 RUN echo "Built with Docker Engine on sac" > /message CMD ["cat", "/message"] EOF docker build -t my-app:1.0 . docker run --rm my-app:1.0For advanced and multi-platform builds, use the Buildx plugin with docker buildx build. Buildx is preinstalled and ready to use.
Check the engine and container storage
The Docker daemon and the containerd runtime run as systemd services and start automatically at boot. Confirm their status with:
systemctl is-active docker.service containerd.serviceContainer image layers, container writable layers and named volumes are stored under the Docker data directory, which is a separate filesystem on its own EBS volume. Confirm the dedicated mount and check free space with:
findmnt /var/lib/docker df -h /var/lib/dockerBecause the container store is on its own volume, you can grow it independently of the operating system disk. Modify the EBS volume in the AWS console or with the CLI.
Then extend the filesystem on the instance with resize2fs against the volume's device.
Maintenance
Keep the operating system patched with the standard package manager. The official Docker APT repository is already configured on the image, so engine upgrades arrive through the normal package update process.
Reclaim disk space by removing unused images, stopped containers and dangling build cache with docker system prune. Review what is using space with docker system df.
docker system dfTo let another Linux user manage containers without sudo, add that user to the docker group. The user then starts a new login session.
sudo usermod -aG docker <username>Support
SecureAnyCloud provides this Amazon Machine Image with 24/7 technical support by email and chat. Contact SecureAnyCloud for help with container deployment, image building, Compose orchestration, storage configuration and engine upgrades.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. All other product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Deploy on AWS
Launch Docker Engine on AWS with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com