-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathubuntu-docker-setup.sh
More file actions
22 lines (16 loc) · 984 Bytes
/
ubuntu-docker-setup.sh
File metadata and controls
22 lines (16 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# Update apt package manager and install required dependencies
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release
# Download and add the Docker GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add the Docker repository to the APT sources
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update the APT sources and install Docker
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Add the current user to the docker group to avoid having to use sudo for every docker command
sudo usermod -aG docker $USER
# Start the Docker service and enable it to start automatically on boot
sudo systemctl start docker
sudo systemctl enable docker