To install Docker on Ubuntu, you can follow these steps:
Step 1: Update the system
Open a terminal and run the following command to update your package list:
sudo apt-get update
Step 2: Install required dependencies
Run the following command to install the necessary packages for Docker installation:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
Step 3: Add Docker's official GPG key
Add Docker's GPG key to ensure the authenticity of the Docker package:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Step 4: Set up the Docker repository
Add Docker’s repository to your APT sources:
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" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Step 5: Update the package list again
Update the APT package list to reflect the new Docker repository:
sudo apt-get update
Step 6: Install Docker
Now, you can install Docker by running the following command:
sudo apt-get install docker-ce
Step 7: Check Docker installation
Once the installation is complete, you can verify if Docker is installed correctly by running:
sudo docker --version
Step 8: Manage Docker as a non-root user (optional)
To avoid using sudo
with Docker commands, add your user to the docker
group:
sudo usermod -aG docker $USER
Then, log out and log back in for this change to take effect.
That's it! Docker should now be installed and running on your Ubuntu system.
标签:sudo,apt,Step,install,ubuntu,docker,Docker From: https://www.cnblogs.com/Tifahfyf/p/18422095