I have a MacMini that is sitting in the server room which has a docker for mac running on it. I'm able to use docker directly on the machine when I ssh in just fine.
$ docker --version
Docker version 19.03.5, build 633a0ea
But I would like to connect to the mac minis docker engine from my own computer using docker-machine. I have tried the following command to create the docker-machine.
docker-machine create -d generic \
--generic-ip-address 10.0.0.0 \
--generic-ssh-key ~/.ssh/mysshkey \
--generic-ssh-user myusername \
--generic-ssh-port 22 \
macmini
Error Messages:
Running pre-create checks...
Creating machine...
(macmini) Importing SSH key...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Error creating machine: Error detecting OS: Error getting SSH command: ssh command error:
command : cat /etc/os-release
err : exit status 1
output : cat: /etc/os-release: No such file or directory
Has anyone been able to connect remotely to docker-engine running MacOS Catalina using docker-machine? Any tips or pointers would be appreciated. Thank you!
Related
I have done the following so far:
brew install qemu (apparently needed for podman, but want to use it for VMs anyway)
brew install podman
modify ~/.config/containers/containers.conf and add following line to [engine] section:
helper_binaries_dir = ["/Users/user/dev/homebrew/Cellar/podman/4.1.0/bin","/Users/user/dev/homebrew/Cellar/podman/4.1.0/libexec"]
podman machine init
podman machine start
Initially, machine start complained it could not dial up a unix socket at var/folders/v0/xqf571mj5sg5x7k4j1dpb1_w0000gn/T/podman/podman-machine-default_ready.sock. That file existed, so don't know what the problem was.
I rebooted to see if that would help, and now that socket file no longer exists, but podman machine start still wants to use it. Rerunning podman machine init just gives this error:
Error: podman-machine-default: VM already exists
That error always occurs once it successfully inits, so doesn't seem to be related to my issue.
That's as far as I can get from various web pages I read. Hopefully someone can provide further help :)
I've been away from using a Mac for over a decade, so really have no idea how stuff like podman is supposed to work, beyond it apparently needs QEMU to run a VM for each container.
Am I better off using Docker Desktop for Mac instead of fighting with podman? If so, I'll just use that. Podman was butt easy on my Linux desktop, but maybe it's not worth the trouble on a Mac, or at least on an M1 since it's an arm.
I had a similar issue yesterday, as have others. The solution comes from the issue thread linked in the comment above. The problem was resolved by downgrading the version of QEMU from the one currently available as default on homebrew.
You can downgrade to QEMU 6.2.0 on Monterrey with the following:
curl -L -H "Authorization: Bearer QQ==" -o qemu-6.2.0_1.monterey.bottle.tar.gz https://ghcr.io/v2/homebrew/core/qemu/blobs/sha256:fcc3b1a8139f70dae57f5449f3856f9b3b67448ee0623e64da1e47dc255b46f6
brew install -f qemu-6.2.0_1.monterey.bottle.tar.gz
After some time debugging, I found the cause of this problem.
This problem is caused due to qemu 7.0.0 startup latency (3-5s) that occour in every first qemu execution after Mac Machine machine boots.
Podman has some bug that doesn't expect that the creation of socks files, done by the qemu call, can be delayed some seconds, and when podman tries to access the socks files, the qemu is not created them yet, showing the error "Error: dial unix /podman/podman-machine-default_ready.sock: connect: connection refused".
To avoid this problem, just execute qemu, even with invalid options (just to initialize), before call "podman machine start".
After some time debugging, I found the cause of this problem.
This problem is caused due to qemu 7.0.0 startup latency (3-5s) that occour in every first qemu execution after Mac Machine machine boots.
Podman has some bug that doesn't expect that the creation of socks files, done by the qemu call, can be delayed some seconds, and when podman tries to access the socks files, the qemu is not created them yet, showing the error "Error: dial unix /podman/podman-machine-default_ready.sock: connect: connection refused".
To avoid this problem, just execute qemu, even with invalid options (just to initialize), before call "podman machine start".
echo "* Podman VM machine for MACOSX is stoped, starting..."
# workaround - initialize qemu before machine start to avoid socket error
/usr/local/bin/qemu-system-x86_64 -machine q35,accel=hvf:tcg -cpu host -display none INVALID_OPTION >> /dev/null 2>&1
podman machine start podman-machine-default
ECODE=$?;if [ $ECODE -ne 0 ];then echo "* Error starting podman linux vm machine: $ECODE";exit $ECODE;fi
I've set up wsl 2:
PS C:\Users\User> wsl --list --verbose
NAME STATE VERSION
* Ubuntu-18.04 Running 2
However when attempting to create a container from wsl the following error is returned:
$ lxc launch ubuntu:18.04 test
Error: Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: no such file or directory
How to launch an LXD container from wsl2? From my understanding it should be possible given that wsl2 is a full linux kernel.
Adding sudo before the command works.
This needs to be done for every command of lxc/lxd.
Docker says it is running, but it clearly isn't.
Machine is OSX 10.15.4
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env default
machine:file user$ ps aux | grep "docker"
user 56224 0.0 0.0 4258892 256 s006 R+ 4:56PM 0:00.00 grep docker
machine:file user$
It seems like you are using docker with boot2docker. It means that docker will run inside a virtual machine instead of your local machin and explain why you don't see the process with "ps". As mention in the Boot2docker github project https://github.com/boot2docker/boot2docker, you should use docker desktop for mac.
No idea what the issue is with Docker - I am trying to get the daemon up/running but can't. Here is the error I get:
➜ ~ bash --login '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
Creating Machine default...
Running pre-create checks...
Creating machine...
(default) OUT | Creating VirtualBox VM...
(default) OUT | Creating SSH key...
(default) OUT | Starting VirtualBox VM...
Error creating machine: Error in driver during machine creation: exit status 1
Starting machine default...
exit status 1
Regenerate TLS machine certs? Warning: this is irreversible. (y/n):
Regenerating TLS certificates
Detecting the provisioner...
Error getting SSH command: Something went wrong running an SSH command!
command : cat /etc/os-release
err : exit status 255
output :
Setting environment variables for machine default...
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
Error getting IP address: Host is not running
docker is configured to use the default machine with IP
For help getting started, check out the docs at https://docs.docker.com
Error running connection boilerplate: default is not running. Please start it
in order to use the connection settings
I am running:
Mac OSX 10.10.5
Docker version 1.9.1, build a34a1d5
VirtualBox version 5.0.10 r104061
I reinstalled the binaries via the toolbox install tool, but to no avail.
VirtualBox is giving a permissions error, so that may be the issue (I installed v4.3 but that didn't help):
/Applications/VirtualBox.app/Contents/MacOS/VMMR0.r0: The owner is not root
If this helps, here is the log output from Kitematic:
/usr/local/bin/docker-machine -D create -d virtualbox --virtualbox-memory 2048 default returned non zero exit code. Stderr: Docker Machine Version: 0.5.1 (7e8e38e) Found binary path at /usr/local/bin/docker-machine-driver-virtualbox
Any suggestions? Thanks
It appears the virtual machine isn't getting created. Start with the same command Kitematic is running to get the full debug out and then add that to your question:
/usr/local/bin/docker-machine -D create -d virtualbox --virtualbox-memory 2048 default
I updated to OSX 10.11 and problem went away. No idea why unfortunately.
I was able to resolve an issue similar.
The issue occurred when I installed docker toolbox a second time.
I uninstalled all Virtual box ethernet drivers virtual box itself and then docker toolbox.
I then recreated the boot2docker machine
docker-machine -D create -d virtualbox --virtualbox-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v1.9.0/boot2docker.iso --virtualbox-memory 2048 default
So im having some weird problems with docker-machine. I am trying to set up a docker-machine on my Mac OS El Capitan and also have the daemon flagged for a few insecure registries. I was able to successfully push/pull on a local Ubuntu install (without docker-machine) by setting the DOCKER_OPTS options to flag my insecure Nexus docker registries. I am trying to accomplish the same end goal on my Mac OS. So far I have installed the Docker Toolbox using a default installation and have tried the following in Terminal.
Vinays-MacBook-Pro:~ Vinay$ sudo docker-machine create --driver virtualbox --
engine-insecure-registry mynexusrepo.cloudapp.net:18443 --engine-insecure-registry mynexusrepo.cloudapp.net:18444 --engine-insecure-registry mynexusrepo.cloudapp.net:18445 dev
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env dev
Vinays-MacBook-Pro:~ Vinay$ eval "$(sudo docker-machine env dev)"
Vinays-MacBook-Pro:~ Vinay$ sudo docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
dev virtualbox Running tcp://192.168.99.100:2376
Vinays-MacBook-Pro:~ Vinay$ sudo docker pull mynexusrepo.cloudapp.net:18445/docker-thirdparty/mongodb:3.0.2
Password:
Post http:///var/run/docker.sock/v1.20/images/create?fromImage=mynexusrepo.cloudapp.net%3A18445%2Fdocker-thirdparty%2Fmongodb%3A3.0.2: dial unix /var/run/docker.sock: no such file or directory.
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?
Vinays-MacBook-Pro:~ Vinay$ sudo docker images
Password:
Get http:///var/run/docker.sock/v1.20/images/json: dial unix /var/run/docker.sock: no such file or directory.
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?
Vinays-MacBook-Pro:~ Vinay$ docker-machine -version
docker-machine version 0.4.1 (e2c88d6)
So I know the sudo docker pull mynexusrepo.cloudapp.net:18445/docker-thirdparty/mongodb:3.0.2 command works since it works fine on my straight Ubuntu OS with a docker install. Is there something else I am missing? I have tried closing all the terminals, deleting all of the docker-machines, restarting, etc.
Thanks!