I would greatly appreciate it if you kindly give me some feedback if you found an error Send feedback to me
- thought and things about docker-machine on apple MacOS High Sierra
> docker-machine create <name of machine>
> docker-machine create vbox-test
- should use standard installed virtualbox
- used standard setting of docker-machine
> docker-machine create --driver=virtualbox virtualbox-test
docker-machine create --driver virtualbox --virtualbox-cpu-count=4 --virtualbox-memory=4096 --virtualbox-disk-size=10000 box-strong
> docker-machine ls
- show env variable for docker-machine
> docker-machine env <name of machine>
> docker-machine env vbox-test
- set env variable for docker-machine
> eval $(docker-machine env <name of machine>)
> eval $(docker-machine env vbox-test)
- unset env variable for docker-machine
> eval $(docker-machine env -u)
-
after this command should you reach your local docker daemon
-
for another docker machine load this present env setting
> eval $(docker-machine env another-docker-machine)
> docker-machine active
- very useful for script
- e.g. see the ssh kez login script
> docker-machine ssh <name of machine>
> docker-machine ssh vbox-test
or
- login via ssh direct
> ssh docker@$(docker-machine ip <name of machine>)
> ssh docker@$(docker-machine ip vbox-test)
- the default password is tcuser
or
-
login via ssh with the kez
-
all credits goes to robert
script_name="docker-machine-kez-virtualbox-login.sh"
cat > ./${script_name} << 'EOL'
#!/bin/bash
if ! docker-machine active; then
echo "No active machine";
echo "Set first with docker-machine env <name of machine>" ;
exit 1
fi
docker_machine_name=$(docker-machine active)
docker_ssh_user=$(docker-machine inspect $docker_machine_name --format={{.Driver.SSHUser}})
docker_ssh_key=$(docker-machine inspect $docker_machine_name --format={{.Driver.SSHKeyPath}})
docker_ssh_port=$(docker-machine inspect $docker_machine_name --format={{.Driver.SSHPort}})
ssh -i $docker_ssh_key -p $docker_ssh_port $docker_ssh_user@localhost
EOL
chmod +x ./${script_name}
@TODO Add accept kez without extra confirm
> docker-machine stop <name of vm>
> docker-machine start vbox-test
> docker-machine start <name of vm>
> docker-machine start vbox-test
- kill only if the machine are not response of docker-machine stop or you can not login via docker-machine ssh
- for debug seethe output of the virtualbox GUI to
> docker-machine kill <name of vm>
> docker-machine kill vbox-test
> docker-machine ip <name of machine>
> docker-machine ip default vbox-test
> docker run --detach --publish <port local:port remote> <name of images>
> docker run -d -p 8000:80 nginx
- check local status of docker-machine from local prompt via ssh login
> curl $(docker-machine ip <name of machine>):<published port>
> curl $(docker-machine ip vbox-test):8000
> docker-machine rm <name of machine>
> docker-machine rm vbox-test