2014-05-01 01:43:01 +00:00
|
|
|
---
|
|
|
|
page_title: "Configuration- Docker Provider"
|
|
|
|
sidebar_current: "docker-configuration"
|
|
|
|
---
|
|
|
|
|
|
|
|
# Docker Configuration
|
|
|
|
|
|
|
|
The Docker provider has some provider-specific configuration options
|
|
|
|
you may set. A complete reference is shown below.
|
|
|
|
|
|
|
|
### Required
|
|
|
|
|
|
|
|
* `build_dir` (string) - The path to a directory containing a Dockerfile.
|
|
|
|
One of this or `image` is required.
|
|
|
|
|
|
|
|
* `image` (string) - The image to launch, specified by the image ID or a name
|
|
|
|
such as `ubuntu:12.04`. One of this or `build_dir` is required.
|
|
|
|
|
|
|
|
### Optional
|
|
|
|
|
2014-10-22 20:12:31 +00:00
|
|
|
General settings:
|
|
|
|
|
2014-05-08 01:42:13 +00:00
|
|
|
* `build_args` (array of strings) - Extra arguments to pass to
|
|
|
|
`docker build` when `build_dir` is in use.
|
|
|
|
|
2014-05-01 01:43:01 +00:00
|
|
|
* `cmd` (array of strings) - Custom command to run on the container.
|
|
|
|
Example: `["ls", "/app"]`.
|
|
|
|
|
|
|
|
* `create_args` (array of strings) - Additional arguments to pass to
|
|
|
|
`docker run` when the container is started. This can be used to set
|
|
|
|
parameters that aren't exposed via the Vagrantfile.
|
|
|
|
|
2015-07-08 22:08:51 +00:00
|
|
|
* `dockerfile` (string) - Name of the Dockerfile in the build directory.
|
|
|
|
This defaults to "Dockerfile"
|
|
|
|
|
2014-05-01 01:43:01 +00:00
|
|
|
* `env` (hash) - Environmental variables to expose into the container.
|
|
|
|
|
|
|
|
* `expose` (array of integers) - Ports to expose from the container
|
|
|
|
but not to the host machine. Useful for links.
|
|
|
|
|
|
|
|
* `link` (method, string argument) - Link this container to another
|
2014-11-28 19:59:20 +00:00
|
|
|
by name. The argument should be in the format of `(name:alias)`.
|
|
|
|
Example: `docker.link("db:db")`. Note, if you're linking to
|
2014-10-22 00:20:19 +00:00
|
|
|
another container in the same Vagrantfile, make sure you call
|
|
|
|
`vagrant up` with the `--no-parallel` flag.
|
2014-05-01 01:43:01 +00:00
|
|
|
|
|
|
|
* `force_host_vm` (boolean) - If true, then a host VM will be spun up
|
|
|
|
even if the computer running Vagrant supports Linux containers. This
|
|
|
|
is useful to enforce a consistent environment to run Docker.
|
|
|
|
|
|
|
|
* `has_ssh` (boolean) - If true, then Vagrant will support SSH with
|
|
|
|
the container. This allows `vagrant ssh` to work, provisioners, etc.
|
|
|
|
This defaults to false.
|
|
|
|
|
2014-05-09 01:46:03 +00:00
|
|
|
* `host_vm_build_dir_options` (hash) - Synced folder options for the
|
|
|
|
`build_dir`, since the build directory is synced using a synced folder
|
|
|
|
if a host VM is in use.
|
|
|
|
|
2014-05-01 01:43:01 +00:00
|
|
|
* `name` (string) - Name of the container. Note that this has to be unique
|
|
|
|
across all containers on the host VM. By default Vagrant will generate
|
|
|
|
some random name.
|
|
|
|
|
2015-07-15 18:08:01 +00:00
|
|
|
* `pull` (bool) - If true, the image will be pulled on every `up` and
|
|
|
|
`reload`. Defaults to false.
|
|
|
|
|
2014-05-01 01:43:01 +00:00
|
|
|
* `ports` (array of strings) - Ports to expose from the container to the
|
|
|
|
host. These should be in the format of `host:container`.
|
|
|
|
|
|
|
|
* `remains_running` (boolean) - If true, Vagrant expects this container
|
|
|
|
to remain running and will make sure that it does for a certain amount
|
|
|
|
of time. If false, then Vagrant expects that this container will
|
|
|
|
automatically stop at some point, and won't error if it sees it do that.
|
|
|
|
|
2014-10-22 00:50:45 +00:00
|
|
|
* `stop_timeout` (integer) - The amount of time to wait when stopping
|
|
|
|
a container before sending a SIGTERM to the process.
|
|
|
|
|
2014-05-01 01:43:01 +00:00
|
|
|
* `vagrant_machine` (string) - The name of the Vagrant machine in the
|
|
|
|
`vagrant_vagrantfile` to use as the host machine. This defaults to
|
|
|
|
"default".
|
|
|
|
|
|
|
|
* `vagrant_vagrantfile` (string) - Path to a Vagrantfile that contains
|
|
|
|
the `vagrant_machine` to use as the host VM if needed.
|
|
|
|
|
|
|
|
* `volumes` (array of strings) - List of directories to mount as
|
|
|
|
volumes into the container. These directories must exist in the
|
|
|
|
host where Docker is running. If you want to sync folders from the
|
|
|
|
host Vagrant is running, just use synced folders.
|
2014-10-22 20:12:31 +00:00
|
|
|
|
|
|
|
Below, we have settings related to auth. If these are set, then Vagrant
|
|
|
|
will `docker login` prior to starting containers, allowing you to pull
|
|
|
|
images from private repositories.
|
|
|
|
|
|
|
|
* `email` (string) - Email address for logging in.
|
|
|
|
|
|
|
|
* `username` (string) - Username for logging in.
|
|
|
|
|
|
|
|
* `password` (string) - Password for logging in.
|
|
|
|
|
|
|
|
* `auth_server` (string) - The server to use for authentication. If not
|
|
|
|
set, the Docker Hub will be used.
|