docker / docs

Source repo for Docker's Documentation
https://docs.docker.com
Apache License 2.0
4.17k stars 7.29k forks source link

When installing docker-ce >= 18.09, should install / uninstall docker-ce-cli #8039

Closed eubnara closed 1 year ago

eubnara commented 5 years ago

Problem description

It seems that docker-ce-cli package has been separated after docker version 18.09. If I install docker-ce through yum install command, docker-ce-cli package will be installed as a dependency but the latest version will be. Therefore, installed docker-ce / docker-ce-cli package version can be different. It is not the desired situation for installer who wants to get the docker with specific version.

Problem location

Suggestions for a fix

It is better to let document readers to know that if they want to get a docker package with specific version, you should uninstall docker-ce-cli, docker-ce and install docker-ce-cli, docker-ce in order.

dmperilla commented 5 years ago

I can also attest to this issue. I am trying to control my environment when installing docker, but I am unable to because of docker-ce-cli not honoring the version specified when installing docker-ce.

Unfortunately, the suggested solution of installing docker-ce-cli, docker-ce in order does not meet my needs. I am configuring my machines with Ansible. I am using the ansible-role-docker to perform the docker installation.

Below are several examples when installing on various vagrant boxes.

Ubuntu16

vagrant@u16:~$ apt list --installed | grep docker

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

vagrant@u16:~$ sudo apt-get install docker-ce=5:18.09.0*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Selected version '5:18.09.0~3-0~ubuntu-xenial' (Docker CE:xenial [amd64]) for 'docker-ce'
The following additional packages will be installed:
  aufs-tools cgroupfs-mount containerd.io docker-ce-cli libltdl7 pigz
Suggested packages:
  mountall
The following NEW packages will be installed:
  aufs-tools cgroupfs-mount containerd.io docker-ce docker-ce-cli libltdl7 pigz
0 upgraded, 7 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/50.4 MB of archives.
After this operation, 243 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package pigz.
(Reading database ... 55031 files and directories currently installed.)
Preparing to unpack .../pigz_2.3.1-2_amd64.deb ...
Unpacking pigz (2.3.1-2) ...
Selecting previously unselected package aufs-tools.
Preparing to unpack .../aufs-tools_1%3a3.2+20130722-1.1ubuntu1_amd64.deb ...
Unpacking aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../cgroupfs-mount_1.2_all.deb ...
Unpacking cgroupfs-mount (1.2) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../containerd.io_1.2.2-1_amd64.deb ...
Unpacking containerd.io (1.2.2-1) ...
Selecting previously unselected package libltdl7:amd64.
Preparing to unpack .../libltdl7_2.4.6-0.1_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-0.1) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../docker-ce-cli_5%3a18.09.1~3-0~ubuntu-xenial_amd64.deb ...
Unpacking docker-ce-cli (5:18.09.1~3-0~ubuntu-xenial) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../docker-ce_5%3a18.09.0~3-0~ubuntu-xenial_amd64.deb ...
Unpacking docker-ce (5:18.09.0~3-0~ubuntu-xenial) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu21.15) ...
Setting up pigz (2.3.1-2) ...
Setting up aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Setting up cgroupfs-mount (1.2) ...
Setting up containerd.io (1.2.2-1) ...
Setting up libltdl7:amd64 (2.4.6-0.1) ...
Setting up docker-ce-cli (5:18.09.1~3-0~ubuntu-xenial) ...
Setting up docker-ce (5:18.09.0~3-0~ubuntu-xenial) ...
update-alternatives: using /usr/bin/dockerd-ce to provide /usr/bin/dockerd (dockerd) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu10) ...

vagrant@u16:~$ docker --version
Docker version 18.09.1, build 4c52b90

vagrant@u16:~$ apt list --installed | grep docker

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

docker-ce/xenial,now 5:18.09.0~3-0~ubuntu-xenial amd64 [installed,upgradable to: 5:18.09.1~3-0~ubuntu-xenial]
docker-ce-cli/xenial,now 5:18.09.1~3-0~ubuntu-xenial amd64 [installed,automatic]

Fedora 28

[vagrant@fedora28 ~]$ sudo yum install docker-ce-3:18.09.0-3.*
Last metadata expiration check: 0:12:40 ago on Fri 08 Feb 2019 08:03:24 PM UTC.
Dependencies resolved.
==============================================================================================================================================================================================================================================
 Package                                                       Arch                                          Version                                                            Repository                                               Size
==============================================================================================================================================================================================================================================
Installing:
 docker-ce                                                     x86_64                                        3:18.09.0-3.fc28                                                   docker-ce-stable                                         19 M
Installing dependencies:
 container-selinux                                             noarch                                        2:2.80-1.git1b655d9.fc28                                           updates                                                  45 k
 containerd.io                                                 x86_64                                        1.2.2-3.fc28                                                       docker-ce-stable                                         18 M
 docker-ce-cli                                                 x86_64                                        1:18.09.1-3.fc28                                                   docker-ce-stable                                         14 M
 iptables                                                      x86_64                                        1.6.2-2.fc28                                                       fedora                                                  487 k
 libnetfilter_conntrack                                        x86_64                                        1.0.7-1.fc28                                                       updates                                                  65 k
 libnfnetlink                                                  x86_64                                        1.0.1-13.fc28                                                      fedora                                                   32 k
 libtool-ltdl                                                  x86_64                                        2.4.6-24.fc28                                                      updates                                                  57 k

Transaction Summary
==============================================================================================================================================================================================================================================
Install  8 Packages

Total size: 51 M
Installed size: 225 M
Is this ok [y/N]: y
Downloading Packages:
[SKIPPED] docker-ce-18.09.0-3.fc28.x86_64.rpm: Already downloaded                                                                                                                                                                            
[SKIPPED] containerd.io-1.2.2-3.fc28.x86_64.rpm: Already downloaded                                                                                                                                                                          
[SKIPPED] docker-ce-cli-18.09.1-3.fc28.x86_64.rpm: Already downloaded                                                                                                                                                                        
[SKIPPED] container-selinux-2.80-1.git1b655d9.fc28.noarch.rpm: Already downloaded                                                                                                                                                            
[SKIPPED] iptables-1.6.2-2.fc28.x86_64.rpm: Already downloaded                                                                                                                                                                               
[SKIPPED] libnfnetlink-1.0.1-13.fc28.x86_64.rpm: Already downloaded                                                                                                                                                                          
[SKIPPED] libnetfilter_conntrack-1.0.7-1.fc28.x86_64.rpm: Already downloaded                                                                                                                                                                 
[SKIPPED] libtool-ltdl-2.4.6-24.fc28.x86_64.rpm: Already downloaded                                                                                                                                                                          
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                      1/1 
  Installing       : libnfnetlink-1.0.1-13.fc28.x86_64                                                                                                                                                                                    1/8 
  Running scriptlet: libnfnetlink-1.0.1-13.fc28.x86_64                                                                                                                                                                                    1/8 
  Installing       : libnetfilter_conntrack-1.0.7-1.fc28.x86_64                                                                                                                                                                           2/8 
  Running scriptlet: libnetfilter_conntrack-1.0.7-1.fc28.x86_64                                                                                                                                                                           2/8 
  Installing       : iptables-1.6.2-2.fc28.x86_64                                                                                                                                                                                         3/8 
  Running scriptlet: iptables-1.6.2-2.fc28.x86_64                                                                                                                                                                                         3/8 
  Installing       : libtool-ltdl-2.4.6-24.fc28.x86_64                                                                                                                                                                                    4/8 
  Running scriptlet: libtool-ltdl-2.4.6-24.fc28.x86_64                                                                                                                                                                                    4/8 
  Installing       : docker-ce-cli-1:18.09.1-3.fc28.x86_64                                                                                                                                                                                5/8 
  Running scriptlet: docker-ce-cli-1:18.09.1-3.fc28.x86_64                                                                                                                                                                                5/8 
  Installing       : container-selinux-2:2.80-1.git1b655d9.fc28.noarch                                                                                                                                                                    6/8 
  Running scriptlet: container-selinux-2:2.80-1.git1b655d9.fc28.noarch                                                                                                                                                                    6/8 
neverallow check failed at /var/lib/selinux/targeted/tmp/modules/100/base/cil:9156
  (neverallow base_typeattr_7 unlabeled_t (file (entrypoint)))
    <root>
    allow at /var/lib/selinux/targeted/tmp/modules/200/container/cil:1573
      (allow spc_t unlabeled_t (file (entrypoint)))

Failed to generate binary
/usr/sbin/semodule:  Failed!
  Installing       : containerd.io-1.2.2-3.fc28.x86_64                                                                                                                                                                                    7/8 
  Running scriptlet: containerd.io-1.2.2-3.fc28.x86_64                                                                                                                                                                                    7/8 
  Running scriptlet: docker-ce-3:18.09.0-3.fc28.x86_64                                                                                                                                                                                    8/8 
  Installing       : docker-ce-3:18.09.0-3.fc28.x86_64                                                                                                                                                                                    8/8 
  Running scriptlet: docker-ce-3:18.09.0-3.fc28.x86_64                                                                                                                                                                                    8/8 
  Verifying        : docker-ce-3:18.09.0-3.fc28.x86_64                                                                                                                                                                                    1/8 
  Verifying        : containerd.io-1.2.2-3.fc28.x86_64                                                                                                                                                                                    2/8 
  Verifying        : docker-ce-cli-1:18.09.1-3.fc28.x86_64                                                                                                                                                                                3/8 
  Verifying        : container-selinux-2:2.80-1.git1b655d9.fc28.noarch                                                                                                                                                                    4/8 
  Verifying        : iptables-1.6.2-2.fc28.x86_64                                                                                                                                                                                         5/8 
  Verifying        : libnfnetlink-1.0.1-13.fc28.x86_64                                                                                                                                                                                    6/8 
  Verifying        : libnetfilter_conntrack-1.0.7-1.fc28.x86_64                                                                                                                                                                           7/8 
  Verifying        : libtool-ltdl-2.4.6-24.fc28.x86_64                                                                                                                                                                                    8/8 

Installed:
  docker-ce.x86_64 3:18.09.0-3.fc28  container-selinux.noarch 2:2.80-1.git1b655d9.fc28  containerd.io.x86_64 1.2.2-3.fc28  docker-ce-cli.x86_64 1:18.09.1-3.fc28  iptables.x86_64 1.6.2-2.fc28  libnetfilter_conntrack.x86_64 1.0.7-1.fc28 
  libnfnetlink.x86_64 1.0.1-13.fc28  libtool-ltdl.x86_64 2.4.6-24.fc28                 

Complete!

[vagrant@fedora28 ~]$ docker --version
Docker version 18.09.1, build 4c52b90

[vagrant@fedora28 ~]$ sudo yum list docker-ce |grep docker-ce
docker-ce.x86_64               3:18.09.0-3.fc28                @docker-ce-stable
docker-ce.x86_64               3:18.09.1-3.fc28                docker-ce-stable 

CentOS7

[vagrant@cent7 ~]$ sudo yum install docker-ce-3:18.09.0-3.*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.ndchost.com
 * extras: mirror.hmc.edu
 * updates: mirrors.ocf.berkeley.edu
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:18.09.0-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================================================
 Package                                                Arch                                                Version                                                       Repository                                                     Size
==============================================================================================================================================================================================================================================
Installing:
 docker-ce                                              x86_64                                              3:18.09.0-3.el7                                               docker-ce-stable                                               19 M

Transaction Summary
==============================================================================================================================================================================================================================================
Install  1 Package

Total download size: 19 M
Installed size: 81 M
Is this ok [y/d/N]: y
Downloading packages:
docker-ce-18.09.0-3.el7.x86_64.rpm                                                                                                                                                                                     |  19 MB  00:00:07     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 3:docker-ce-18.09.0-3.el7.x86_64                                                                                                                                                                                           1/1 
  Verifying  : 3:docker-ce-18.09.0-3.el7.x86_64                                                                                                                                                                                           1/1 

Installed:
  docker-ce.x86_64 3:18.09.0-3.el7                                                                                                                                                                                                            

Complete!

[vagrant@cent7 ~]$ docker --version
Docker version 18.09.1, build 4c52b90

[vagrant@cent7 ~]$ sudo yum list | grep docker-ce
containerd.io.x86_64                        1.2.2-3.el7                @docker-ce-stable
docker-ce.x86_64                            3:18.09.0-3.el7            @docker-ce-stable
docker-ce-cli.x86_64                        1:18.09.1-3.el7            @docker-ce-stable
docker-ce.x86_64                            3:18.09.1-3.el7            docker-ce-stable
docker-ce-selinux.noarch                    17.03.3.ce-1.el7           docker-ce-stable
thaJeztah commented 5 years ago

Unfortunately, the suggested solution of installing docker-ce-cli, docker-ce in order does not meet my needs. I am configuring my machines with Ansible. I am using the ansible-role-docker to perform the docker installation.

I think the solution for that would be to open an enhancement request in that repository.

w.r.t. the request to make the cli (docker-ce-cli) always have the exact same version as the engine (docker-ce); this was a conscious choice to allow the user to upgrade/downgrade components individually. In future, we're exploring the option to provide meta-packages that tie all packages (cli, engine, containerd, runc) to exact versions for situations, but there's no ETA for those packages yet.

Nipuna-Sankalpa commented 5 years ago

Hi, I'm having a problem where I can't even find the docker-ce package. This is my repolist.

[root@xxxx-xxxx-xxx yyyyy]# yum repolist
docker-ce-stable/x86_64                                                         Docker CE Stable - x86_64                                                                              8+35
elastic-6.x                                                                     Elastic repository for 6.x packages                                                                     490
epel/x86_64                                                                     Extra Packages for Enterprise Linux 7 - x86_64                                                     13,219+1
jenkins                                                                         Jenkins-stable                                                                                           88
jlaska-proot/x86_64                                                             Copr repo for proot owned by jlaska                                                                     2+1
lynis                                                                           CISOfy Software - Lynis package                                                                          41
mariadb                                                                         MariaDB                                                                                                79+1
newrelic/x86_64                                                                 New Relic packages for Enterprise Linux 5 - x86_64                                                      192
newrelic-infra                                                                  New Relic Infrastructure                                                                                252
pgdg94/7Server/x86_64                                                           PostgreSQL 9.4 7Server - x86_64                                                                         779
rackspace                                                                       Rackspace Monitoring                                                                                      1
rackspace-rhel-x86_64-server-7-common                                           Rackspace - RHEL  x86_64 Server 7 - Common                                                               96
rackspace-rhel-x86_64-server-7-ius                                              Rackspace - RHEL (v. 7 for 64-bit x86_64) - IUS                                                       8,497
rhel-x86_64-server-7                                                            Red Hat Enterprise Linux Server (v. 7 for 64-bit x86_64)                                             24,345
rhel-x86_64-server-optional-7                                                   RHEL Server Optional (v. 7 64-bit x86_64)                                                            17,777
rhn-tools-rhel-x86_64-server-7                                                  RHN Tools for RHEL Server (v. 7 for x86_64)                                                             136
rs-epel/x86_64                                                                  Extra Packages for Enterprise Linux 7 - x86_64                                                     13,218+2
spp                                                                             HP SPP                                                                                                1,388
repolist: 80,608

but if I execute

[root@xxxx-xxx-xxxx yyyy]# yum search docker
Loaded plugins: ps, replace, rhnplugin
This system is receiving updates from RHN Classic or Red Hat Satellite.
=================================================================================== N/S matched: docker ===================================================================================
golang-github-fsouza-go-dockerclient-devel.x86_64 : Client for the Docker remote API
imagefactory-plugins-Docker.noarch : Cloud plugin for Docker
pcp-pmda-docker.x86_64 : Performance Co-Pilot (PCP) metrics from the Docker daemon
python-docker-scripts.noarch : Collection of scripts to help manage Docker
python-dockerfile-parse.noarch : Python library for Dockerfile manipulation
python2-avocado-plugins-runner-docker.noarch : Avocado Runner for Execution on Docker Containers
python2-dockerpty.noarch : Python library to use the pseudo-tty of a docker container
python36-docker.noarch : A Python library for the Docker Engine API
python36-docker-pycreds.noarch : Python bindings for the docker credentials store API
python36-dockerpty.noarch : Python library to use the pseudo-tty of a docker container
kdocker.x86_64 : Dock any application in the system tray
kompose.x86_64 : Tool to move from 'docker-compose' to Kubernetes
reg.x86_64 : Docker registry v2 command line client

Cannot fine docker-ce package here, anyone knows why is this happening?

thaJeztah commented 5 years ago

Is your package cache/index up to date?

jmarcos-cano commented 5 years ago

Indeed this was added to documentation: https://docs.docker.com/install/linux/docker-ce/centos/#install-docker-engine---community-1

I was also having troubles when I upgrade docker in my docker swarms via Ansible, I ended up adding:

- name: install Docker latest
  yum: name={{item}} state=present update_cache=yes
  become: yes
  become_user: root
  with_items:
  - docker-ce
  - docker-ce-cli

Of course I have another to install a specific version

alexion1 commented 4 years ago

This worked for me:

VERSION=5:18.09*
sudo apt install -y docker-ce=$VERSION docker-ce-cli=$VERSION

see more here: https://docs.docker.com/install/linux/docker-ce/ubuntu/

pacoxu commented 4 years ago

according to https://serverfault.com/questions/964152/what-does-docker-version-name-means

18.09.3: the major release number from docker's rolling releases 5: the patch number, where fixes are released without new functionality

dleedev365 commented 4 years ago

The suggested fix worked for me. The following steps resolved my issue for Ubuntu 18.04 LTS on Windows Virtualbox:

  1. sudo apt remove docker-ce-cli
  2. sudo apt remove docker-ce
  3. sudo apt install docker-ce-cli
  4. sudo apt install docker-ce
  5. sudo apt-get update -y
  6. sudo docker run hello-world (to test)
  7. sudo docker login --username= --password

My docker version: Client: Docker Engine - Community Version: 19.03.8 API version: 1.40 Go version: go1.12.17 Git commit: afacb8b7f0 Built: Wed Mar 11 01:25:46 2020 OS/Arch: linux/amd64 Experimental: false

Server: Docker Engine - Community Engine: Version: 19.03.8 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: afacb8b7f0 Built: Wed Mar 11 01:24:19 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683

docker-robott commented 1 year ago

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 14 days. This helps our maintainers focus on the active issues.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robott commented 1 year ago

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked