How to ssh into docker-machine VirtualBox instance?

后端 未结 7 1989
萌比男神i
萌比男神i 2020-12-22 16:57

docker-machine version 0.2.0 docker version 1.6.2

I\'m using docker-machine to create a machine using VirtualBox. Everything works fine but I\'d like to ssh into th

7条回答
  •  -上瘾入骨i
    2020-12-22 17:37

    For mac OX,the machine and its keys are located here (make sure you have the keys in there, something like the below:

    ~/project/dev/docker_notes za$ ls /Users/za/.docker/machine/machines/default/
    .DS_Store        ca.pem           config.json      disk.vmdk        id_rsa.pub       server-key.pem
    boot2docker.iso  cert.pem         default/         id_rsa           key.pem          server.pem
    

    1) list available vms.

    > ~/project/dev/docker_notes za$ docker-machine ls
    >     NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
    >     default   -        virtualbox   Running   tcp://192.168.99.100:2376           v1.11.0
    

    In my case, the name of the machine is default. So, just

    ~/project/dev/docker_notes za$ docker-machine ssh default
    
    
                            ##         .
                      ## ## ##        ==
                   ## ## ## ## ##    ===
               /"""""""""""""""""\___/ ===
          ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
               \______ o           __/
                 \    \         __/
                  \____\_______/
     _                 _   ____     _            _
    | |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
    | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
    | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
    |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
    Boot2Docker version 1.11.0, build HEAD : 32ee7e9 - Wed Apr 13 20:06:49 UTC 2016
    Docker version 1.11.0, build 4dc5990
    docker@default:~$ vi 
    .ash_history  .ashrc        .docker/      .local/       .profile      .ssh/         log.log
    docker@default:~$ ls
    log.log
    

    As you can see, I am able to ssh into docker-machine/instance.

    docker@default:~$ uname -a
    Linux default 4.1.19-boot2docker #1 SMP Thu Apr 7 02:41:05 UTC 2016 x86_64 GNU/Linux
    

    You can also follow this > howto - docker

提交回复
热议问题