Learn how to install Docker in Linux. Docker is the next step of virtualization which does Operating system level virtualization also known as containerization.
Install Docker open-source on Linux SUSE Posted on 25 March 2019 by Thibaut To install Docker on Linux SUSE, we need first to add Virtualization repository with Zypper.
In this article, we will walk you through the procedure to install Docker in any Linux distro like RHEL, SUSE, OEL, CentOS, Debian, Fedora, Ubuntu, etc. Sometimes your package manager like YUM or apt-get may offer package
docker* to install docker on your server but it’s always good to get a fresh Docker setup. Since Docker is changing fast and it’s always advisable to install the latest version of Docker which might not be available with your package manager.
Read all docker or containerization related articles here from KernelTalk’s archives.
If your package manager has a Docker package available to install then it’s an easy way to get Docker on your system.
Before going got Docker installation you should install below packages on your system to use the full flexible functionality of Docker. These packages are not dependencies but its good to have them pre-installed so that all Docker functions/drivers you can use.
But you may not be getting the latest version of Docker in this case. You can install a package simply using yum or apt-get command. Below sample output for your reference from the OpenSuse server.
In the below procedure, we will be using the script from Docker’s official website which will scan your system for details and automatically fetch the latest and compatible docker version for your system and installs it. We will be fetching script from this docker URL and using it to install the latest Docker on the list of Linux distros.
Fetch the latest script from docker official website using curl. If you read this script,
SUPPORT_MAP variable shows the list of Linux distros this script support. If you are running any other Linux version than listed here then this method won’t be useful for you.
Now we have latest
get-docker.sh script from docker official website on our server. Now, you just have to run the script and it will do the rest!
If you observe the above output then you will get to know that script will detect your OS and will download, configure, and use supported repo to install Docker on your machine. It also notifies you to add non-root user to group
docker so that he/she can run docker commands with root privileges.
You can download and run the script this in a single command as well like below –
If you are running the script on un-supported Linux version (which is not mentioned in
SUPPORT_MAP list) then you will see below error.
If you are on RHEL, SLES (basically Enterprise Linux editions) then only Docker EE i.e. Enterprise Edition (paid) is supported on them. You will need to purchase appropriate subscriptions to use them. You will see below message –
If both above methods are not suitable for you then you can always opt for the last method. Head to Docker online store. Goto Docker CE i.e. Community Edition (the free one) and choose your Linux distro. Currently, they have listed AWS, Azure, Fedora, CentOS, Ubuntu & Debian. Click on your choice, head to Resources tab, and click Detailed installation instructions. You will be redirected to appropriate documents on Docker documents which have detailed step by step commands to perform a clean install of Docker on Linux of your choice! Or you can always head to this home page of installation and choose your host.
Finally, you have to check if Docker is installed on the system. To check if docker is installed, simply run the command
The last line in the above output shows that the Docker service is not yet running on the server. You can start the service and then the output will show your Docker server details as well.
So, now you have successfully installed Docker on your machine and started the Docker server. You are yet to create containers in it!
For non-root user to use Docker, you need to add the user into a group called
docker. This group is automatically gets created when you install Docker.
Run above command to add non-root user in
docker group and then that user will be able to run all docker commands without root privileges.
Also, you need to make sure that docker services start automatically when the server reboots. Since system control systemctl is becoming standard on all latest Linux versions, below command will suit on nearly major Linux distros
This command will enable docker to run with system boot and hence no root intervention needed when the system reboots. Non-root users will continue to use docker even after a reboot.
If you want to try Docker without installing it on your machine then just head to Play with Docker website and you will be able to spin up machines having Docker in it. You can try Docker commands in it from your web browser!
The only limitation they have is your session will be auto closed after 4 hours. You have a clock ticking in your browser window set to 4 hours once you log in.