Docker Toolbox Mac command line and Kitematics fails - macos

I have installed the new Docker Toolbox application for the Mac using both the graphical installer (the official one) and brew cask install.
In both cases, the Virtual Machine is correctly created, but something seems to be wrong in the environment because when I try to execute docker-machine on the command line, it fails like this:
$ docker-machine env default
open /Users/adeynack/.docker/machine/machines/default/ca.pem: no such file or directory
When I try Kitematics, it fails like this:
I tried Delete VM and retry setup, without success. Any insight or idea is welcome here.
EDIT: I am already using the test build 5.0.3 of VirtualBox.

This may have been caused by an issue with Virtualbox. The issue has been fixed with the latest testbuild for virtualbox here: Virtualbox Test build.
You have to uninstall your current version of Virtual Box and install the test build.
Edit
You may need to create a new docker machine.
Create a new docker machine:
docker-machine create --driver virtualbox dev
Next, start the dev environment:
docker-machine env dev
Set up the environment for the dev machine:
eval "$(docker-machine env dev)"

This worked for me:
docker-machine regenerate-certs default
docker-machine restart default

Related

Having trouble getting docker to work on mac

OK so here is what I have done so far. I installed docker for mac, and that worked fine. From there I tried to get a project up and running using docker-compose and I got the following error:
Could not read CA certificate "/Users/<useraccountfolder>/.boot2docker/certs/boot2docker-vm/ca.pem": open /Users/<useraccountfolder>/.boot2docker/certs/boot2docker-vm/ca.pem: no such file or directory
So I tried to fix it by trying this accepted answer. This is when I got another error, Host does not exist: “default”. This is when I trie this accepted answer, but when I tried to run docker-machine create default, I got this error: Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path". I am just lost at this point. Any help?
To use docker machine you need the latest version of VirtualBox, from the docker docs:
IF YOU ARE USING DOCKER FOR MAC
Docker for Mac uses HyperKit, a lightweight macOS virtualization solution built on top of the Hypervisor.framework in macOS 10.10 Yosemite and higher.
Currently, there is no docker-machine create driver for HyperKit, so you will use virtualbox driver to create local machines. (See the Docker Machine driver for Oracle VirtualBox.) Note that you can run both HyperKit and Oracle VirtualBox on the same system. To learn more, see Docker for Mac vs. Docker Toolbox.
Make sure you have the latest VirtualBox correctly installed on your system (either as part of an earlier Toolbox install, or manual install).
Source: https://docs.docker.com/machine/get-started/#prerequisite-information
OK so I found a solution which is probably not fixing the root issue, but it does work. To unset previous variables I ran this command unset ${!DOCKER*}. This worked, but then I had to run it every time I started a new terminal session, so I added it to my .bash_profile and now I am good.

How to run "docker-machine create" in OS X?

I started Docker and am now following the tutorial, but for all I know I couldn't run the docker-machine command on OS X.
The documentation states that you run the following command to create a local virtual machine:
docker-machine create --driver virtualbox manager
However, this command doesn't work in OS X (11.6), with the following error:
Running pre-create checks...
Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"
I tried to install the virtualbox; however, another page clearly states that you must not install it on your local machine:
VirtualBox prior to version 4.3.30 must NOT be installed (it is incompatible with Docker for Mac)
Note: If your system does not satisfy these requirements, you can install Docker Toolbox, which uses Oracle VirtualBox instead of HyperKit.
So I only installed Docker for Mac and not virtualbox. So what am I missing here? The example page says you can run the tutorial on OS X, so I wonder how I can proceed...
You can follow along and run this example using Docker for Mac, Docker for Windows or Docker for Linux.
I had the same issue today and resolved it by installing VirtualBox as an additional step after installing Docker for Mac (I did so with brew install --cask virtualbox)
I don't recall having to do the extra install previously, but maybe I already had VirtualBox already installed because of another tool (like Vagrant). Anyway, this is explained in the Docker Machine documentation:
If you are using Docker for Mac
Docker for Mac uses HyperKit, a lightweight macOS virtualization
solution built on top of the Hypervisor.framework in macOS 10.10
Yosemite and higher.
Currently, there is no docker-machine create driver for HyperKit, so
you will use virtualbox driver to create local machines. (See the
Docker Machine driver for Oracle VirtualBox.) Note that you can run
both HyperKit and Oracle VirtualBox on the same system. To learn more,
see Docker for Mac vs. Docker Toolbox.
Make sure you have the latest VirtualBox correctly installed on your system (either as part of an earlier Toolbox install, or manual
install).
I had the same issue. At the same spot ;-)
For me the xhyve driver, available from https://github.com/zchee/docker-machine-driver-xhyve, worked.
In short:
brew install docker-machine-driver-xhyve
You get a notice some links need to be created manually, so copy those and execute
sudo chown root:wheel /usr/local/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chown root:wheel /usr/local/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
Create:
docker-machine create --driver xhyve manager
Without VirtualBox. Im using OS X 10.11.6, too.
After updating my docker docker-machine command stopper working on my mac terminal.
So found after updating my docker I'll have to reinstall docker-machine CLI just to get the latest version.
Updated docker-machine to latest one using the command below helped me making docker-machine command working again.
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-
machine &&
chmod +x /usr/local/bin/docker-machine
See Docs (https://docs.docker.com/machine/install-machine/#install-machine-directly)

Docker not working in Windows10

I am using Docker version 1.12.2, build bb80604 and VirtualBox 5.1.6.
I was able to install Docker Toolbox correctly but I am not able to start the default VM.
I tried to follow the instruction given here but I am still getting The system cannot find the file specified error. I don't have Hyper-V enabled on system.
F:\>docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default not found Error open C:\Users\Animesh\.docker\machine\machines\default\config.json: The system cannot find the file specified.
F:\>docker-machine env --shell=cmd
open C:\Users\Animesh\.docker\machine\machines\default\config.json: The system cannot find the file specified.
F:\>docker rm default
An error occurred trying to connect: open //./pipe/docker_engine: The system cannot find the file specified.
How can I solve this issue?
It looks like something bad happened to your docker-machine default machine.
To recover, do the following:
docker-machine rm -f default
Next, open the virtualbox GUI and make sure that there isn't a VM that corresponds with that old "default" VM, just in case. If there is, manually delete it from there.
Now, open the quickstart terminal again and it should create a new "default" virtual machine for you.
Alternatively, you can create it like this:
docker-machine create -d virtualbox --virtualbox-memory 2048 default
At that point, your sequence of commands should work as expected again.
You may need another couple of steps additional to what #programmerq mentioned.
Create empty text file: C:\Users\<user>\.docker\machine\machines\default\config.json
Stop VBoxHeadless.exe service from Windows task manager
Try docker-machine rm -f default and docker-machine create -d virtualbox --virtualbox-memory 2048 default commands afterwards to remove/add default
step 1: run: docker-machine rm -f default - (on your mac terminal or control panel)
step 2: run: docker-machine create -d virtualbox --virtualbox-memory 2048 default
It worked like miracle.
If you are a Windows Home user, you will not be able install the Docker for Windows Desktop edition, as it requires Hyper-V virtualization. This is supported only by Windows Professional and Enterprise editions.
As the Docker for Windows Desktop edition requires Hyper-V virtualization, you will not be able to install it if you are a Windows Home user. It is only supported by Windows Professional and Enterprise editions.
If you have installed Docker Toolbox and you are dealing with errors while trying to start the default machine you can create a new one by running:
docker-machine create box
the in order to see how to connect your Docker Client to the Docker Engine running on the virtual machine created run:
docker-machine env box
the command that you need to run in order to configure your shell will then appear:
eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env box)
Check that the installation is runnung correctly by running:
docker run hello-world
Then you just need to start your machine every time you need to use docker:
docker-machine start box
and follow the second and third steps above for the configuration.

Running docker shell on Windows

I've just installed Docker toolbox 1.9.1 (only docker itself plus Kitematic as I already have both VirtualBox and Git for Windows installed). Clicking on Docker Quickstart Terminal icon wasn't working so I had to associate it with C:\Program Files (x86)\Git\bin\bash.exe as suggested. Now it starts fine but I'm unable to run docker command:
Kitematic works just fine but I need the shell. How do I fix it?
Check where docker-machine.exe has been installed (or copy the latest released one in your %PATH%) and use that, instead of the quickstart.
From a regular CMD session:
# find the name of the machine created.
docker-machine ls
docker-machine env --shell cmd <nameOfTheMachine>
docker-machine ssh <nameOfTheMachine>
The shell you are after is the one provided by the Linux TinyCore boot2docker.iso image managed by VirtualBox, not the git-bash installed on your Windows host.
Here is an alternative option. Create the following docker.cmd batch:
cd "%ProgramFiles%\Docker Toolbox"
"%ProgramFiles(x86)%\Git\bin\bash.exe" --login -i "%ProgramFiles%\Docker Toolbox\start.sh"
Now you need to start the default VM in your Oracle VirtualBox Manager (created automatically when you installed Docker for Windows):
and then the batch:

How to Setup a Docker Tomcat Container on Mac OS X

I'm new to Docker...
From my understanding, Docker is only compatible with Linux, is it possible to run docker for development purposes on a Mac?
I installed virtualbox using homebrew and have tried to create a virtualbox instance. I installed docker, but am having trouble getting my mac to communicate with the vm docker instance. My end goal is to get a locally debuggable instance of tomcat running on the docker container.
Any help or tips would be helpful.
Information:
Because Docker only runs on Linux you will need to install some kind of virtual instance on your local machine. An easy and popular way to do that is to install
Boot2docker and VirtualBox. VirtualBox is a dependency of Boot2docker. You can download, setup and install the latest versions from their websites or if you are using Homebrew, as you mentioned, you can quickly get the working binaries both in one step.
After installing boot2docker, you're ready to use Boot2docker to create a Tomcat Container. You can find a pre-configured tomcat image by searching Docker's community repository, docker hub registry.
Notes:
Each time you execute the docker run command a new container is created.
The VM running Docker requires a ssh private/public encryption key handshake to connect to. If you follow my steps below, one will be generated for you.
Steps to Setup Tomcat using the tomcat image:
Open Terminal and run this command: brew install boot2docker
Create a new Boot2Docker VM instance using the init command: boot2docker init
Run this command in Terminal to forward local ports to the vm:
for i in {10000..10999}; do VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$i,tcp,,$i,,$i”; VBoxManage modifyvm "boot2docker-vm" --natpf1 "udp-port$i,udp,,$i,,$i";done
Start the boot2docker daemon: boot2docker start or boot2docker up
After starting docker, copy the exports that are displayed from the previous command to your clipboard
Edit your bash profile file ~/.bash_profile (or if you are using zsh, edit the resource configuration file ~/.zshrc) with a text editor (I prefer using Sublime text): subl .zshrc *note: this will permanently save the docker env variables.
Paste the exports into that file and save
Execute the source command on the file: source .zshrc
Pull the latest tomcat image to create a container and start tomcat: docker run -it --rm -p 10080:8080 tomcat:8.0 *note: this will forward your local 10080 port to the vm's 8080 port.
Go to http://localhost:10080, you should see the tomcat start page!
Useful Docker commands:
$ boot2docker status
$ docker version
$ docker ps #shows running containers
$ docker ps -a # shows all containers
$ docker exec -it NAME /bin/bash #to start a bash session on the container. -i = interactive, -t = tty
External Resources:
https://docs.docker.com/installation/mac/#installation
https://registry.hub.docker.com/_/tomcat/
Most people use boot2docker to run on Macs. You may also want to take a look at Kitematic, which gives you a GUI to play with.
Finally, the future is probably to use docker machine, which can provision a VM for you.
Docker requires Linux Kernel features, hence it cannot be run natively on OSX.
See instead Boot2Docker. This link gives you instructions on how to get going.

Resources