Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

How to get newest docker engine on MacOS with open-source Docker? #4895

Open
kumikumi opened this issue Sep 3, 2021 · 5 comments
Open

How to get newest docker engine on MacOS with open-source Docker? #4895

kumikumi opened this issue Sep 3, 2021 · 5 comments

Comments

@kumikumi
Copy link

kumikumi commented Sep 3, 2021

After installing both docker and docker-machine from Homebrew and setting up docker-machine with a VirtualBox driver, the docker version command reports that my client version is 20.10.8 whereas the server version is 19.03.12.

I would like to upgrade to the latest server version (20.10.8 at the time of posting), that should still be open source if I'm not mistaken.

As it appears that docker-machine is not actively maintained anymore, what is the correct way to upgrade to the latest docker server version (without using proprietary Docker software)? Are there any instructions anywhere? Thanks

@afbjorklund
Copy link
Contributor

afbjorklund commented Sep 5, 2021

Version 19.03 is indeed the last and final version of boot2docker, the Linux distribution of Docker machine. It is now deprecated

You can use an Ubuntu VM and install Docker in it, but docker-machine only does this for cloud drivers (and doesn't support 20.10)

@afbjorklund
Copy link
Contributor

afbjorklund commented Sep 5, 2021

Like so: https://boot2podman.github.io/2020/07/22/machine-replacement.html

(mostly written for use with Podman, but also shows instructions for Docker)

vagrant init ubuntu/focal64
vagrant up
vagrant ssh

See https://www.vagrantup.com/

vagrant@ubuntu-focal:~$ curl -fsSL https://get.docker.com | sudo sh
vagrant@ubuntu-focal:~$ sudo usermod -aG docker $USER
vagrant@ubuntu-focal:~$ newgrp docker

See https://docs.docker.com/engine/install/ubuntu/


The docker client (installed with brew) uses ssh to talk to the docker daemon socket in the VM.

export DOCKER_HOST=ssh://vagrant@127.0.0.1:2222

ssh-add -k .vagrant/machines/default/virtualbox/private_key

Not all third party tools support ssh: yet, so you might have to upgrade those or set up legacy tcp:.

It is also possible to tunnel the unix: socket over ssh, to create a local file for clients not yet on 18.09 (that added ssh)


You could use another virtualization solution, by doing the same commands as in the Vagrantfile...

@lfoalpha
Copy link

lfoalpha commented Sep 10, 2021

examples docker-machine with vagrant.

<example>/
|__ Vagrantfile
|__ docker-compose.yml ... example for docker container(php:apache).
|__ index.php          ... example php source.

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/hirsute64"

  config.vm.network "private_network", ip: "192.168.33.10"

  # mapping working dir to vm as same path.
  config.vm.synced_folder ENV["PWD"], ENV["PWD"]
end

docker-compose.yml

version: "3"
services:
  php:
    image: "php:apache"
    volumes:
      - ".:/var/www/html"
    ports:
      - "80:80"

index.php

<?php
phpinfo();

launch vagrant vm.

vagrant up

register to docker-machine with generic driver.

docker-machine create --driver generic \
	       --generic-ip-address "192.168.33.10" \
	       --generic-ssh-key $PWD/.vagrant/machines/default/virtualbox/private_key \
	       --generic-ssh-port 22 \
	       --generic-ssh-user "vagrant" \
	       docker-with-vagrant-vm

apply docker-machine environment variables.

eval $(docker-machine env docker-with-vagrant-vm)

list docker machines.

docker-machine ls
NAME                     ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER      ERRORS
docker-with-vagrant-vm   *        generic      Running   tcp://192.168.33.10:2376            v20.10.8

launch docker container.

docker-compose up -d

open browser.

open http://192.168.33.10/

@afbjorklund
Copy link
Contributor

Nice! I was thinking to do a vagrant-machine to wrap it (Vagrant), but in retrospect a Vagrant machine-driver would have been better...

@kumikumi
Copy link
Author

Here is another project that I'm following closely: https://github.com/abiosoft/colima

It is the most promising Docker Desktop replacement for Mac I have seen and I have had the most success with it so far.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants