Search code examples
dockerubuntudocker-compose

Install Docker in Kubuntu 20.04 LTS


I'm a Windows user who is trying to migrate to Kubuntu (I have made a lot of research and I strongly believe that it is the best fit for me and my needs). I'm a Cloud Developer (AWS) and Data Engineer.

As part of my job, I use Docker to develop my solutions. I would like to have an advice from anyone who has succesfully installed and used Docker (among others, I plan to use it highly with Apache Airflow). I have read the Docker's docs, but they clearly say that they don't test Docker on any other flavour than main Ubuntu.

So, to anyone who has used Docker in Kubuntu, have you ever experimented any limitations with it? Or any bugs? Is the setup process difficult?

I'm looking for an advice, this is the only topic that is holding me to migrate to Kubuntu, and I couldn't find any experience on any forum related specifically to Docker in Kubuntu.

Thanks a lot in advance.


Solution

  • Long time Kubuntu (and other KDE based OS) user here. I can assure you that there are no limitations, special bugs or whatsoever when it comes to docker on Kubuntu.

    Perhaps it is going to help if I clarify something about Kubuntu (the same applies to Xubuntu, Lubuntu and so on):

    Kubuntu is nothing more than "normal" Ubuntu that uses KDE. To most people the biggest difference is the fact that the Plasma Desktop is being used, which essentially is just a different UI. You can think of it as a different browser if you want to: no matter which browser you are using (Firefox, Chrome, ...) the underlying OS is still the same.

    So what you could do is start out with "plain" Ubuntu, perform some installation, configuration and cleanup tasks and turn it into Kubuntu if you wanted to. To avoid doing all that manually you can download Kubuntu right away which is exactly that.

    So whenever it comes to installing something on Kubuntu, just look for the "normal" installation process for "plain" Ubuntu.

    So to answer your question regarding installation:

    There are multiple ways to install Docker on Ubuntu. People may argue that the "easiest" way would be to use a script provided by docker:

    $ curl -fsSL https://get.docker.com -o get-docker.sh
    $ sudo sh get-docker.sh
    

    Which works just fine, however, issues may come up if you try to update docker later on using the same way, therefore I usually prefer to use the "native" apt way which you can also turn into an ansible playbook later on if you wanted to:

    $ sudo apt-get update
    $ sudo apt-get install \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg \
        lsb-release
    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    $ 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
    $ sudo apt-get update
    $ sudo apt-get install docker-ce docker-ce-cli containerd.io
    $ sudo docker run hello-world
    

    People then oftentimes get confused because docker is not working for their "normal" user. After installing docker make sure to check out the post-installation steps.

    Most people want docker to work with their "normal" user which means you would have to add him to the docker group:

    $ sudo groupadd docker
    $ sudo usermod -aG docker $USER
    

    There are many ways to ensure that the changes take effect, however, the safest way is to reboot your machine. After rebooting you should now be able to use docker with your "normal" user (note that there is no sudo being used):

    $ docker run hello-world