-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloud-init.yml
More file actions
60 lines (47 loc) · 1.58 KB
/
Copy pathcloud-init.yml
File metadata and controls
60 lines (47 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#cloud-config
# Update apt package index
package_update: true
package_upgrade: true
# Install required packages
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
- software-properties-common
# Run commands to install Docker
runcmd:
# Add Docker's official GPG key
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add Docker repository
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update apt package index again
- apt-get update
# Install Docker Engine, containerd, and Docker CLI
- apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Start and enable Docker service
- systemctl start docker
- systemctl enable docker
# Add ubuntu user to docker group (adjust username as needed)
- usermod -aG docker ubuntu
# Verify Docker installation
- docker --version
# Optional: Set timezone
timezone: UTC
# Optional: Configure automatic security updates
package_reboot_if_required: true
# Write additional files if needed
write_files:
- path: /etc/docker/daemon.json
content: |
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
permissions: '0644'
# Final message
final_message: "Docker installation completed! System is ready."