Linux VM with docker

We make available a minimal Alpine Linux virtual machine with docker and sshd installed ready to be imported in Virtualbox.

  1. Import the appliance in Virtualbox (File->Import Appliance, accept default configuration)
  2. Run the machine in headless mode (Machine->Start->Headless Start)
  3. NEW Wait that the machine boots and then connect via ssh with ssh docker@localhost -p2222 password docker (same as root password) (NOTE: this has been updated due to the problems with host only network in windows 10 and now works on localhost port 2222)
  4. NEW When you run a docker container you can use port 2223 to map any port of the container to your host. For example:
    docker run -p2223:22 --rm -it mycontainer bash

    binds port 22 (ssh) of  mycontainer to port 2223. Then you can directly ssh to mycontainer from you host using that port.
    If you need to map more than one port at the same time, go to setting->network (adapter 1)->Advanced->Port Forwarding and add another entry as needed.

  5. Run your preferred docker images

Adding extra packages

Feel free of changing the user and root password if you wish and add you preferred Alpine packages!

Make sure that /etc/apk/repositories contains the following:

#/media/cdrom/apks
http://dl-cdn.alpinelinux.org/alpine/v3.11/main
http://dl-cdn.alpinelinux.org/alpine/v3.11/community
#http://dl-cdn.alpinelinux.org/alpine/edge/main
#http://dl-cdn.alpinelinux.org/alpine/edge/community
#http://dl-cdn.alpinelinux.org/alpine/edge/testing

For example, to install docker-compose just follow these simple steps:

alpine-docker:~$ su -
Password: (root password is 'docker')
alpine-docker:~# apk update
...
alpine-docker:~# apk add docker-compose
...
alpine-docker:~# exit
alpine-docker:~$

Enjoy!