Docker is an application that allows for deployment of software within virtual containers. It was written in the Go programming language. In this tutorial, you’ll learn how to install Docker CE on Debian 9.
Docker CE is the “Community Edition”, which is suitable for developers and small teams.
1GB of RAM is the minimum requirement, though I recommend using at least 2GB of RAM.
Connect to your server using SSH via the Terminal on Mac or PuTTY on Windows.
ssh [email protected]
Replace “18.104.22.168” with your server IP.
You will be prompted to type “Yes” or “No” to add the server’s RSA fingerprint to your list of known hosts. Type “Yes” and hit “Enter“.
Now you are connected as root, so you don’t need to use sudo. If you connect as a user you will need sudo to perform most of the actions.
On a fresh machine, as root, update apt.
Install packages to allow apt to use a repository over HTTPS.
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
Add Docker’s official GPG key.
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
Verify that key fingerprint is equal to: 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
apt-key fingerprint 0EBFCD88
Use the following command to set up the stable repository.
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
Update apt again.
apt-get install docker-ce -y
If you don’t want to run Docker as the root user, create a non-root user.
Then, add this user to the Docker group.
usermod -aG docker foo
Now restart the Docker service.
service docker restart
Verify that Docker CE is installed correctly by running the hello-world image.
docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints a message like this one and exits.
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9a0669468bf7: Pull complete
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
For more examples and ideas, visit:
Powered by BetterDocs