How to install docker from apt on Ubuntu?

6,884

Solution 1

Have you checked that you're installing the correct package? When I look at the Ubuntu package repository listing I find the following description for the docker package:

System tray for KDE3/GNOME2 docklet applications

You should be able to check this from the command-line as well:

user@host:~$ apt-cache search docker | grep '^docker - '

docker - System tray for KDE3/GNOME2 docklet applications

According to the installation instructions you linked to, the docker.io package is out-dated. You probably want to follow those instructions for installing the community edition. The alternative is the enterprise edition, which is commercial software.

The installation method recommended by the official installation guide is to use the docker repository. In order to make this solution self-contained, I'll extract a subset of those instructions and reproduce them here:

Step 1. Update the apt package index:

sudo apt-get update

Step 2. Install packages to allow apt to use a repository over HTTPS:

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

Step 3. Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Step 4. Set up the stable repository (command depends on system architecture):

sudo add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

Step 5. Update the package index again:

sudo apt-get update

Step 6. Install the docker-ce package (the service should start automatically after installation):

sudo apt-get install docker-ce

Step 7. Verify that docker installed properlty:

sudo docker run hello-world

Solution 2

According to package-search. The docker.service is in zesty (source universe)in package docker.io. sudo apt install docker.io

Share:
6,884
Thufir
Author by

Thufir

Updated on September 18, 2022

Comments

  • Thufir
    Thufir over 1 year

    How do I start the docker service?

    thufir@doge:~$ 
    thufir@doge:~$ sudo apt install docker
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    docker is already the newest version (1.5-1).
    0 upgraded, 0 newly installed, 0 to remove and 230 not upgraded.
    thufir@doge:~$ 
    thufir@doge:~$ sudo systemctl status docker
    Unit docker.service could not be found.
    thufir@doge:~$ 
    thufir@doge:~$ sudo service docker start
    Failed to start docker.service: Unit docker.service not found.
    thufir@doge:~$ 
    thufir@doge:~$ cat /etc/lsb-release 
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=17.04
    DISTRIB_CODENAME=zesty
    DISTRIB_DESCRIPTION="Ubuntu 17.04"
    thufir@doge:~$ 
    

    Is this not how to install docker? I was referencing digital ocean and AWS, but doge, above, is a laptop. The install directions I referenced from docker aren't concrete nor specific, although there's another guide for docker CE (Community Edition).

    Installing from apt won't work?

    ahh, maybe it's docker.io and not docker which needs to be installed:

    Service docker start not work linux ubuntu-15.10

    Maybe with snap?

    https://github.com/docker/docker-snap

    • Thufir
      Thufir over 6 years
      @GAD3R very generous of you :) but perhaps my fumbling about confused you! pardon about that. This question is specific to apt, so, yes, I think actually is duplicate -- almost certainly. or, at least, also has I think, correct answer below. I haven't tested the answer yet.
  • Thufir
    Thufir over 6 years
    I think this is what snap is for?
  • igal
    igal over 6 years
    @Thufir Maybe snap works as well. I'm not sure why you're looking for alternative solutions though. The official documentation tells you exactly what it wants you to do.
  • igal
    igal over 6 years
    The docker.io packaged is outdated, according to the official documentation. The new package is docker-ce.