{"id":17287919,"url":"https://github.com/wscherphof/docker-vm","last_synced_at":"2025-03-26T17:24:50.558Z","repository":{"id":21398257,"uuid":"24716144","full_name":"wscherphof/docker-vm","owner":"wscherphof","description":"Easy access to your virtual machine running Docker ","archived":false,"fork":false,"pushed_at":"2014-10-30T12:15:29.000Z","size":260,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T22:43:57.192Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wscherphof.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-02T11:18:16.000Z","updated_at":"2014-12-28T15:06:58.000Z","dependencies_parsed_at":"2022-07-30T04:48:01.408Z","dependency_job_id":null,"html_url":"https://github.com/wscherphof/docker-vm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wscherphof%2Fdocker-vm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wscherphof%2Fdocker-vm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wscherphof%2Fdocker-vm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wscherphof%2Fdocker-vm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wscherphof","download_url":"https://codeload.github.com/wscherphof/docker-vm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245700395,"owners_count":20658211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T10:06:57.710Z","updated_at":"2025-03-26T17:24:50.497Z","avatar_url":"https://github.com/wscherphof.png","language":"Shell","readme":"docker-vm\n=========\n\nIf you run your Docker host as a virtual machine, this repo provides a quick \u0026 easy way to start it \u0026 connect to it (through ssh) from the computer that hosts the VM\n\n## Usage\n- Just run the applicable `docker` script\n- If you're asked for your (sudo) password, it's for accessing the hosts file, where the address is updated (if it changed) so you can consistently connect to the VM by name (e.g. `http://docker` if you have a web server container running)\n- Use `docker -h` if you don't want it to update your hosts file\n- To stop the Docker VM: `docker stop`\n\n## Current limitations\n- Only VirtualBox VMs\n- VM name must be `Docker`\n- Only runs from bash (if you're on Windows, you should be good to go after installing [GitHub for Windows](https://windows.github.com/), and start `bash` from the Git Shell, though the path to `/etc/hosts` should probably be prefixed with `/c/windows/system32/drivers` then)\n\n## Ubuntu Server on VirtualBox\nThis is how I set up my environment:\n\n- On MacBook Pro Retina mid 2013\n- Connected to the Internet w/ DHCP server in local network\n\n### 1. Install VirtualBox\n- [Download](https://www.virtualbox.org/wiki/Downloads)\n- Double click\n\n### 2. Create Virtual Machine\n- [Download .iso file](http://www.ubuntu.com/download/server) (I had `ubuntu-14.04.1-server-amd64.iso`)\n- In VirtualBox menu `Machine | New...`\n- Type: Linux\n- Version: Ubuntu (64 bit)\n- 4096 MB RAM (or less ;-))\n- Create new virtual disk now\n- VDI (VirtualBox Disk Image)\n- Dynamically allocated\n- 50 GB (or less)\n- Start the new machine \u0026 choose the downloaded ubuntu .iso file to install the OS\n- Accept all default options, except:\n- Host name: `docker`\n- User name: same as host\n- Partitioning method: Guided - use entire disk\n- Write changes to disks? Yes\n- Install security updates automatically\n- Choose software to install: OpenSSH server\n\n### 3. Install VirtualBox Guest Additions\n- After reboot, login\n- `$ sudo -i`\n- `$ apt-get update`\n- `$ apt-get -y upgrade`\n- `$ apt-get -y install dkms`\n- `$ reboot`\n- After reboot, login\n- `$ sudo -i`\n- In VirtualBox menu (with Ubuntu server window focused) `Devices | Insert Guest Additions CD image...`\n- `$ mount /dev/cdrom /media/cdrom`\n- `$ cd /media/cdrom`\n- `$ ./VBoxLinuxAdditions.run` - the last line will state \"Could not find the X.Org or XFree86 Window System, skipping;\" that's alright, since we have a windowless server\n\n### 4. Configure networking\n- Tell Ubuntu you want a second network adapter:\n```\n$ cat \u003e\u003e /etc/network/interfaces \u003c\u003cEOF\n\n# The secondary network interface\nauto eth1\niface eth1 inet dhcp\nEOF\n```\n- In VirtualBox menu (with Ubuntu server window focused) `Machine | ACPI Shutdown`\n- In the machine settings, choose Network tab\n- Adapter 1:\n  - Enable Network Adapter\n  - Attached to: Host-only Adapter (this will let you reach the VM from your host computer)\n- Adapter 2:\n  - Enable Network Adapter\n  - Attached to: NAT (this will let you reach the Internet from the VM)\n- OK\n\n### 5. Create Shared Folder\n- In the machine settings, choose Shared Folders tab\n- Click the tiny icon \"Adds a new shared folder definition\" and select Folder Path \"Other...\"\n- Create a new directory on the host computer to share with the Ubuntu Server VM (existing directories may not get recognised by VirtualBox, especially \"special\" ones, like your home directory)\n- Choose the newly created folder\n- Folder name: `host`\n- Select `Auto-mount` and `Make permanent`\n- OK\n\n### 6. Verify Network \u0026 Shared Folder\n- Startup the VM \u0026 login\n- `$ ip -f inet addr` - verify that the eth0 and eth1 interfaces list a (DHCP-supplied) address\n- `$ ls -la /media` - verify that the shared folder `sf_host` is listed, and owned by root in the vboxsf group\n- `$ sudo adduser \u003cyou\u003e vboxsf` - this will add your user to the vboxsf group\n- `$ exit`\n- Login again\n- `$ ls /media/sf_host` - verify you don't get \"permission denied\"\n\n### 7. Install Docker\n- `$ sudo -i`\n- Optional: see the [Docker installation page](https://docs.docker.com/installation/ubuntulinux/)\n- `$ apt-get -y install docker.io`\n- `$ ln -sf /usr/bin/docker.io /usr/local/bin/docker`\n- `$ sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io`\n- `$ docker version` - verify that this reports the client \u0026 server versions of Docker\n\n### 8. Optional: nsenter\n- Optional: see the [nsenter readme](https://github.com/jpetazzo/nsenter)\n- `$ docker run --rm -v /usr/local/bin:/target jpetazzo/nsenter`\n\n### 9. Optional: passwordless ssh\n- On the host machine (where you'll run the ssh client to access the Docker VM) `$ ssh-keygen -t dsa` to generate a key, if not already done\n- `$ cat ~/.ssh/id_dsa.pub | ssh \u003cdocker-vm-ip\u003e \"mkdir -p .ssh \u0026\u0026 cat \u003e\u003e ~/.ssh/authorized_keys\"` - to list your key as an authorised key on the Docker VM (answer yes to the authenticity question \u0026 enter your password to connect)\n- `$ ssh \u003cdocker-vm-ip\u003e` - verify that you weren't asked for your password now\n- `$ exit` - leave the ssh session\n\n### 10. Install the start script\n- `$ sudo cp ./VirtualBox/docker /usr/local/bin`\n- Test drive:\n```\n$ docker\nStarting Docker VM...............done\nWelcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-32-generic x86_64)\n\n * Documentation:  https://help.ubuntu.com/\n\n  System information as of Thu Oct  2 21:14:02 CEST 2014\n\n  System load: 0.0                Memory usage: 1%   Processes:       77\n  Usage of /:  41.3% of 45.15GB   Swap usage:   0%   Users logged in: 0\n\n  Graph this data and manage this system at:\n    https://landscape.canonical.com/\n\nLast login: Thu Oct  2 21:13:24 2014 from 192.168.59.3\nwsf@docker:~$ sudo docker version\n[sudo] password for wsf: \nClient version: 1.0.1\nClient API version: 1.12\nGo version (client): go1.2.1\nGit commit (client): 990021a\nServer version: 1.0.1\nServer API version: 1.12\nGo version (server): go1.2.1\nGit commit (server): 990021a\nwsf@docker:~$ exit\nlogout\nConnection to 192.168.59.101 closed.\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwscherphof%2Fdocker-vm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwscherphof%2Fdocker-vm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwscherphof%2Fdocker-vm/lists"}