Docker gives the ability to:
- Build an application with a docker Image.
- Ship a application with docker Hub.
- Run an application as a Docker Container.
Docker work flow:
The docker client is stateless. The docker image is downloded in the docker host. If the image exists in the docker host, the constainer is run. Otherwise, the image is first downloaded then the container is run.
Few Notables Features of Docker for Mac:
- Docker for Mac runs in a LinuxKit VM.
- Docker for Mac uses HyperKit instead of Virtual Box. Hyperkit is a lightweight macOS virtualization solution built on top of Hypervisor.framework in macOS 10.10 Yosemite and higher.
- Docker for Mac does not use
docker-machineto provision its VM. The Docker Engine API is exposed on a socket available to the Mac host at
/var/run/docker.sock. This is the default location Docker and Docker Compose clients use to connect to the Docker daemon, so you to use
docker-composeCLI commands on your Mac.
Create docker machine on MAC:
$sudo docker-machine create --driver=virtualbox myhost
If you have this error :
Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"
$brew cask install virtualbox
If you have this error:
Error: Failure while executing; `/usr/bin/sudo -E -- /usr/bin/env LOGNAME=user USER=user USERNAME=user /usr/sbin/installer -pkg /usr/local/Caskroom/virtualbox/6.1.0,135406/VirtualBox.pkg -target / -applyChoiceChangesXML /var/folders/44/w_dcvttx7tv_fg1j0709txqc0000gn/T/choices20200319-41965-17kducy.xml` exited with 1. Here's the output:
To enable virtualbox installation, you need to enable its kernel extension in: System Preferences → Security & Privacy → General
How to connect your Docker Client to the Docker Engine running on this virtual machine?
$sudo docker-machine env myhost
Run this command to configure your shell
$eval $(docker-machine env myhost) ~ $env | grep DOCKER DOCKER_HOST=tcp://192.168.99.100:2376 DOCKER_MACHINE_NAME=myhost DOCKER_TLS_VERIFY=1 DOCKER_CERT_PATH=/Users/meriem/.docker/machine/machines/myhost
Access to the command of the container jboss/wildfly
$sudo docker container run -it --name web jboss/wildfly bash [jboss@53850546ab7b ~]$ pwd /opt/jboss
Under the Hood: Demystifying Docker For Mac CE Edition. http://collabnix.com/how-docker-for-mac-works-under-the-hood/
User-Approved Kernel Extension Loading. https://developer.apple.com/library/archive/technotes/tn2459/_index.html