Docker Version Variable Confusion (docker_latest_version & docker_version)
jamiejackson opened this issue ยท 16 comments
What's the intended relationship between docker_latest_version
and docker_version
?
Is one supposed to trump the other?
# Always ensure latest version of Docker CE
docker_latest_version: true
...
# Docker version
# ex. 18.06.1.ce-3.el7
docker_version: ''
@jamiejackson I can confess that it became not that self explanatory. ๐ The relation between these variables are as follows:
- If
docker_version
is set to a non-empty value (e.g.18.06.1.ce-3.el7
) then that is used. - If
docker_version
is empty (default) anddocker_latest_version
is set totrue
(default) then latest version will be installed and if older version is installed it will be upgraded. - If
docker_version
is empty (default) anddocker_latest_version
is set tofalse
then it will only install latest version if not some Docker version is already installed.
Maybe I should write this in some documentation somewhere. ๐
Do ask me more questions if it is not clear!
That's helpful, thanks.
As I mentioned in #105, I had been running my local environment without any docker versioning information, so the role had installed v19. Now that I want to downgrade, I'm running into trouble
docker_swarm:
advertise_nic: ens192
docker_compose_ver: 1.23.2
docker_enable_audit: true
docker_enable_ce_edge: false
docker_enable_mount_flag_fix: false
docker_enable_swarm: true
docker_daemon_config:
# bip gets docker0 to have a consistent ip. need that to access host's
# postfix from the container:
# https://jira.icfwebservices.com/browse/CPD-10025?focusedCommentId=394243
bip: 172.17.0.1/16
disable-legacy-registry: true
debug: false
icc: false
init: true
live-restore: false
log-driver: journald
storage-driver: overlay2
userland-proxy: false
# to figure out available versions: `yum --showduplicates list docker-ce``
docker_version: '3:19.03.0-3.el7'
Available versions: https://gist.github.com/jamiejackson/07b5bd0a948cc8a0ecb18bb8fa9047ea
I keep seeming to end up with v19 even if I sudo yum remove docker-ce
, then re-run the role:
$ docker --version
Docker version 19.03.0, build aeac9490dc
Whoops, obvious mistake, in that I specified 19 in the yaml. Sorry, working too fast. Going to try again.
Okay, still having some issues:
Starting state:
- Role: 2.1.1
- Docker version vars in role: None specified
- Resulted in: Docker v19
Changes
- Role: 2.5.1
- Config (note available versions here).
docker_version: '3:18.09.8-3.el7'
- Resulted in
TASK [haxorof.docker_ce : Ensure Docker CE is installed] *********************** FAILED - RETRYING: Ensure Docker CE is installed (3 retries left). FAILED - RETRYING: Ensure Docker CE is installed (2 retries left). FAILED - RETRYING: Ensure Docker CE is installed (1 retries left). failed: [docker-host] (item=docker-ce-cli) => {"ansible_loop_var": "item", "attempts": 3, "changed": false, "item": "docker-ce-cli", "msg": "No package matching 'docker-ce-cli-3:18.09.8-3.el7' found available, installed or updated", "rc": 126, "results": ["No package matching 'docker-ce-cli-3:18.09.8-3.el7' found available, installed or updated"]} FAILED - RETRYING: Ensure Docker CE is installed (3 retries left). FAILED - RETRYING: Ensure Docker CE is installed (2 retries left). FAILED - RETRYING: Ensure Docker CE is installed (1 retries left). x`failed: [docker-host] (item=docker-ce) => {"ansible_loop_var": "item", "attempts": 3, "changed": false, "item": "docker-ce", "msg": "No package matching 'docker-ce-3:18.09.8-3.el7' found available, installed or updated", "rc": 126, "results": ["No package matching 'docker-ce-3:18.09.8-3.el7' found available, installed or updated"]} ok: [docker-host] => (item=containerd.io)
Take away from the above: We may want to explain which nugget out of the actual package name is appropriate for docker_version
. Maybe others would grok that without explanation, but I didn't.
Then I tried:
diff --git a/infrastructure/ansible/group_vars/all.yml b/infrastructure/ansible/group_vars/all.yml
index 1b46af6..3b52562 100644
--- a/infrastructure/ansible/group_vars/all.yml
+++ b/infrastructure/ansible/group_vars/all.yml
@@ -19,7 +19,7 @@
# postfix from the container:
#
bip: 172.17.0.1/16
- disable-legacy-registry: true
+# disable-legacy-registry: true
debug: false
icc: false
init: true
@@ -27,6 +27,8 @@
log-driver: journald
storage-driver: overlay2
userland-proxy: false
+# to figure out available versions: `yum --showduplicates list docker-ce`
+docker_version: '18.09.8-3.el7'
media_share:
ignore_mount_errors: false
This ran all the way through, but I still ended up with docker version 19.03.0
. Not sure what's going on yet.
@haxorof , that's the value I tried under the "Then I tried" heading, which still resulted in docker version 19.03.0
existing on the host.
hmm.. can you run with ansible-playbook -v ....
and just give me the output for task haxorof.docker_ce : Ensure Docker CE is installed
?
@jamiejackson As soon as the test suite I am currently running is finished I could do a specific test just to see if I get the same result. Is it latest CentOS version you are running?
It's running "CentOS Linux release 7.6.1810 (Core)".
TASK [haxorof.docker_ce : Ensure Docker CE is installed] ***********************
ok: [docker-host] => (item=docker-ce-cli) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "changes": {"installed": ["docker-ce-cli-18.09.8-3.el7"]}, "item": "docker-ce-cli", "msg": "", "rc": 0, "results": ["Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirror.compevo.com\n * epel: mirror.coastal.edu\n * extras: ewr.edge.kernel.org\n * updates: mirror.hostduplex.com\nPackage matching 1:docker-ce-cli-18.09.8-3.el7.x86_64 already installed. Checking for update.\nNothing to do\n"]}
ok: [docker-host] => (item=docker-ce) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "docker-ce", "msg": "", "rc": 0, "results": ["3:docker-ce-18.09.8-3.el7.x86_64 providing docker-ce-18.09.8-3.el7 is already installed"]}
ok: [docker-host] => (item=containerd.io) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "containerd.io", "msg": "", "rc": 0, "results": ["containerd.io-1.2.6-3.3.el7.x86_64 providing containerd.io is already installed"]}
Oh, this is interesting. I'd been looking at docker --version
for the last few tests, but maybe that' was the wrong thing to look at. Or maybe there's a mismatch:
[vagrant@docker-host ~]$ docker --version
Docker version 19.03.0, build aeac9490dc
[vagrant@docker-host ~]$ yum info docker-ce
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.dal10.us.leaseweb.net
* epel: mirrors.lug.mtu.edu
* extras: mirror.millry.co
* updates: mirror.tocici.com
Installed Packages
Name : docker-ce
Arch : x86_64
Epoch : 3
Version : 18.09.8
Release : 3.el7
Size : 81 M
Repo : installed
From repo : docker-ce-stable
Summary : The open-source application container engine
URL : https://www.docker.com
License : ASL 2.0
Description : Docker is is a product for you to build, ship and run any application as a
: lightweight container.
:
: Docker containers are both hardware-agnostic and platform-agnostic. This means
: they can run anywhere, from your laptop to the largest cloud compute instance and
: everything in between - and they don't require you to use a particular
: language, framework or packaging system. That makes them great building blocks
: for deploying and scaling web apps, databases, and backend services without
: depending on a particular stack or provider.
Available Packages
Name : docker-ce
Arch : x86_64
Epoch : 3
Version : 19.03.0
Release : 3.el7
Size : 24 M
Repo : docker-ce-stable/x86_64
Summary : The open-source application container engine
URL : https://www.docker.com
License : ASL 2.0
Description : Docker is a product for you to build, ship and run any application as a
: lightweight container.
:
: Docker containers are both hardware-agnostic and platform-agnostic. This means
: they can run anywhere, from your laptop to the largest cloud compute instance and
: everything in between - and they don't require you to use a particular
: language, framework or packaging system. That makes them great building blocks
: for deploying and scaling web apps, databases, and backend services without
: depending on a particular stack or provider.
@jamiejackson Aha, what does it say when you run docker version
. Then is shall print both the engine and client version.
Since Docker 18.09 it is not just docker-ce
package but also docker-ce-cli
Okay, for what it's worth, I ran yum remove docker-ce-cli
, then re-ran the playbook and got:
TASK [haxorof.docker_ce : Ensure Docker CE is installed] ***********************
changed: [docker-host] => (item=docker-ce-cli) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "changes": {"installed": ["docker-ce-cli-18.09.8-3.el7"]}, "item": "docker-ce-cli", "msg": "", "rc": 0, "results": ["Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirror.compevo.com\n * epel: mirror.csclub.uwaterloo.ca\n * extras: ewr.edge.kernel.org\n * updates: mirror.hostduplex.com\nResolving Dependencies\n--> Running transaction check\n---> Package docker-ce-cli.x86_64 1:18.09.8-3.el7 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package Arch Version Repository Size\n================================================================================\nInstalling:\n docker-ce-cli x86_64 1:18.09.8-3.el7 docker-ce-stable 14 M\n\nTransaction Summary\n================================================================================\nInstall 1 Package\n\nTotal download size: 14 M\nInstalled size: 66 M\nDownloading packages:\nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n Installing : 1:docker-ce-cli-18.09.8-3.el7.x86_64 1/1 \n Verifying : 1:docker-ce-cli-18.09.8-3.el7.x86_64 1/1 \n\nInstalled:\n docker-ce-cli.x86_64 1:18.09.8-3.el7 \n\nComplete!\n"]}
changed: [docker-host] => (item=docker-ce) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "changes": {"installed": ["docker-ce-18.09.8-3.el7"]}, "item": "docker-ce", "msg": "", "rc": 0, "results": ["Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirror.compevo.com\n * epel: mirror.compevo.com\n * extras: ewr.edge.kernel.org\n * updates: mirror.hostduplex.com\nResolving Dependencies\n--> Running transaction check\n---> Package docker-ce.x86_64 3:18.09.8-3.el7 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package Arch Version Repository Size\n================================================================================\nInstalling:\n docker-ce x86_64 3:18.09.8-3.el7 docker-ce-stable 19 M\n\nTransaction Summary\n================================================================================\nInstall 1 Package\n\nTotal download size: 19 M\nInstalled size: 81 M\nDownloading packages:\nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n Installing : 3:docker-ce-18.09.8-3.el7.x86_64 1/1 \n Verifying : 3:docker-ce-18.09.8-3.el7.x86_64 1/1 \n\nInstalled:\n docker-ce.x86_64 3:18.09.8-3.el7 \n\nComplete!\n"]}
ok: [docker-host] => (item=containerd.io) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "containerd.io", "msg": "", "rc": 0, "results": ["containerd.io-1.2.6-3.3.el7.x86_64 providing containerd.io is already installed"]}
And now I seem to be in sync:
[vagrant@docker-host ~]$ docker --version
Docker version 18.09.8, build 0dd43dd87f
[vagrant@docker-host ~]$ yum info docker-ce
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.dal10.us.leaseweb.net
* epel: mirrors.kernel.org
* extras: mirror.millry.co
* updates: mirror.tocici.com
Installed Packages
Name : docker-ce
Arch : x86_64
Epoch : 3
Version : 18.09.8
Release : 3.el7
Size : 81 M
Repo : installed
From repo : docker-ce-stable
Summary : The open-source application container engine
URL : https://www.docker.com
License : ASL 2.0
Description : Docker is is a product for you to build, ship and run any application as a
: lightweight container.
:
: Docker containers are both hardware-agnostic and platform-agnostic. This means
: they can run anywhere, from your laptop to the largest cloud compute instance and
: everything in between - and they don't require you to use a particular
: language, framework or packaging system. That makes them great building blocks
: for deploying and scaling web apps, databases, and backend services without
: depending on a particular stack or provider.
Available Packages
Name : docker-ce
Arch : x86_64
Epoch : 3
Version : 19.03.0
Release : 3.el7
Size : 24 M
Repo : docker-ce-stable/x86_64
Summary : The open-source application container engine
URL : https://www.docker.com
License : ASL 2.0
Description : Docker is a product for you to build, ship and run any application as a
: lightweight container.
:
: Docker containers are both hardware-agnostic and platform-agnostic. This means
: they can run anywhere, from your laptop to the largest cloud compute instance and
: everything in between - and they don't require you to use a particular
: language, framework or packaging system. That makes them great building blocks
: for deploying and scaling web apps, databases, and backend services without
: depending on a particular stack or provider.
or:
[vagrant@docker-host ~]$ docker version
Client:
Version: 18.09.8
API version: 1.39
Go version: go1.10.8
Git commit: 0dd43dd87f
Built: Wed Jul 17 17:40:31 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.8
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 0dd43dd
Built: Wed Jul 17 17:10:42 2019
OS/Arch: linux/amd64
Experimental: false
So maybe the playbook doesn't necessarily keep the cli and the daemon in sync.
Thanks @jamiejackson ! I think I start to see this might be related to a bug in the role which I bumped into when switching between channels (#81).
I think I need to do a test case for this to capture this "downgrade" scenario. ๐
Just did a downgrade test and it failed when it try to verify the version. Is not related only to the docker-ce-cli
and think that you got a mismatch because you manually removed the docker-ce
package some time along the way.
Anyway, the test clearly failed:
TASK [fail] ********************************************************************
Wednesday 24 July 2019 20:01:13 +0000 (0:00:00.435) 0:01:29.386 ********
fatal: [test-host]: FAILED! => {"changed": false, "msg": "Expected Docker Engine 18.09.8 (Actual: 19.03.0)"}
I think this is the same issue I got when I was switching between test and stable channel.
Thanks you for all input on this etc!
Seems it is not that trivial in Ansible to handle downgrades. Wrote a comment in ticket #81 also but here is the manual way for CentOS/RHEL:
yum downgrade docker-ce docker-ce-cli 18.09.8-3.el7
Added additional explaination for docker_version in defaults.