Skip to content

Instantly share code, notes, and snippets.

@dikarel
Created December 10, 2016 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dikarel/eaa2451ed1655c4758bab09061f1a9c0 to your computer and use it in GitHub Desktop.
Save dikarel/eaa2451ed1655c4758bab09061f1a9c0 to your computer and use it in GitHub Desktop.
Setting up a Docker machine for corporate environments

Create default Docker machine on VirtualBox with custom settings

You might want to do this to allocate extra RAM and disk size for Docker (esp. when dealing with large container images)

  1. Ensure that there's not yet been a Docker machine called 'default' (docker-machine ls). If so, you should remove it (docker-machine rm default).
    In theory, you can just create a second machine with a different name. This is not recommended since VirtualBox assigns IP addresses to each machine non-deterministically every time you restart your computer, causing docker-machine to choke on TLS cert-related issues

  2. Run the following in Bash. If in MS-DOS command prompt, use ^ instead of \

docker-machine create \
  -d virtualbox \
  --virtualbox-cpu-count 4 \
  --virtualbox-memory 4096 \
  --virtualbox-no-share \
  --virtualbox-disk-size 50000 \
  --engine-env http_proxy=http://192.168.0.78:8080 \
  --engine-env https_proxy=http://192.168.0.78:8080 \
  --engine-env no_proxy=127.0.0.1,localhost \
  default

The above setting:

  • Assigns 4 CPU cores
  • Allocates 50 gigs of disk space
  • Allocates 4gb RAM
  • Sets HTTP Proxy settings for corporate environments (to http://192.168.0.78:8080 as an example)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment