Skip to content

Instantly share code, notes, and snippets.

@ahnbizcad
Last active June 16, 2021 00:01
Show Gist options
  • Save ahnbizcad/611e922f2208d6492cc587762c54d8b2 to your computer and use it in GitHub Desktop.
Save ahnbizcad/611e922f2208d6492cc587762c54d8b2 to your computer and use it in GitHub Desktop.
Setting up docker on a VirtualBox VM

Docker

follow instructions https://store.docker.com/search?offering=community&operating_system=linux&q=&type=edition

add user to docker usergroup sudo usermod -a -G docker {linux_user}

  • restart the VM with a full shutdown (or else permissions will still be denied when using docker commands)

Docker Compose

  • download to tmp folder curl -L https://github.com/docker/compose/releases/download/1.12.0/docker-compose-Linux-x86_64 > /tmp/docker-compose

  • make it executable chmod +x {docker-compose}

  • move it to /usr/local/bin/ (you normally can't write to that path, which is why it was written under the /tmp folder) sudo mv docker-compose /usr/local/bin

  • check if successful docker-compose --version

  • (while running) Windows terminal script to run when VM instance sleeps, wakes up, and can't connect to network. programmatically sets the network to none, and then bridge, while the VM instance is running. "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "{vm_instance_name}" nic1 null "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "{vm_instance_name}" nic1 bridged "Intel(R) Dual Band Wireless-AC 8260"

Docker Images Instances docker pull neo4j

IF docker hangs and kills the network functionality

pkill docker

iptables -t nat -F

ifconfig docker0 down

brctl delbr docker0

docker -d

Usage commands

containers

  • list docker ps
  • create container
  • start container
  • stop container
  • destroy container

images

compose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment