nickjj / ansible-docker

Install / Configure Docker and Docker Compose using Ansible.
MIT License
750 stars 224 forks source link

Support for docker.io package (in addition to ce and ee) #100

Closed sdwilsh closed 2 years ago

sdwilsh commented 3 years ago

I'm trying to use Ubuntu server on a raspberry pi3 in an effort to have fewer operating systems in my home that I have to remember differences on. Unfortunately, Ubuntu's support for the pi3 in 20.04 isn't great, but 20.10 is good enough. However, that means there's no docker-ce package available.

However, debian maintains docker.io packages that are usable in 20.10, and this would also provide a path forward for folks who have to use non-LTS version of Ubuntu for various reasons.

nickjj commented 3 years ago

Hi,

A number of folks have used this role as is on a pi3. What limitations are there with Ubuntu 20.04 on it? What about using Debian?

sdwilsh commented 3 years ago

I'm complicating my setup by netbooting with an iSCSI root, which I have not gotten to work in 20.04, but have with 20.10.

Regardless of that, I'm also a bit biased towards docker.io for reasons stated in this stackoverflow thread that say it far better than I can.

I'm happy to attempt a pull request on this, but I didn't want to put in the effort if it wasn't something you wanted to support.

nickjj commented 3 years ago

Docker still officially recommends installing Docker with docker-ce so I think it's best to stick with that standard by default.

You can also choose to only install the CLI with docker-ce-cli too, which I don't think is an option with docker.io. This role supports CLI only installations by setting ce-cli as the docker__edition.

I'm kind of reluctant to support 20.10 (or more generally non-LTS releases) because I have no experience using them, and I haven't had anyone ever request support for it. Most folks who use Ubuntu in production stick with LTS. There's also sometimes subtle differences with non-LTS releases that may require other changes in the future. That and Docker doesn't officially support installing itself on Ubuntu 20.10.

But with that said, I'm not opposed to supporting which package gets installed, such as docker__package and then you are free to choose docker-ce, docker-ce-cli, docker-ee, or docker.io but that's not a straight forward change because:

  1. It's a very backwards incompatible change that will break everyone's configuration if they customized docker__edition
  2. It would mean explicitly hard coding things like "if docker__package == docker.io then skip pulling in Docker's apt repos"
  3. If someone wanted to use docker-ce on 20.10, it's not going to work by default because I dynamically pull in the distro name when setting Docker's apt repo, but since Docker doesn't support "groovy" you'd have to go in and configure docker__apt_key_url and docker__apt_repository to hard code focal (technically supported but kind of hacky)

I wouldn't open a PR just yet because this would need careful planning and quite a bit of documentation to implement properly.

In the mean time you could fork this role and then make these 2 changes:

Hard code docker.io as the package name here: https://github.com/nickjj/ansible-docker/blob/5fbac1ae4a23c2d4f1c3a9030afd215920014e96/tasks/main.yml#L54

Delete these lines: https://github.com/nickjj/ansible-docker/blob/5fbac1ae4a23c2d4f1c3a9030afd215920014e96/tasks/main.yml#L22-L30.

nickjj commented 2 years ago

I'm going to close this as it hasn't been brought up again for a few years. If it comes up again we can deal with it.