Commit graph

309 commits

Author SHA1 Message Date
Brian Cain
34e53a5a4b
Add docker provider class test
This commit introduces aa provider_test class for the Docker provider
2019-06-04 13:24:07 -07:00
Anders Kaseorg
7980178d19 providers/docker: Add usability test
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-05-30 13:13:43 -07:00
Brian Cain
ca0fd64ded
Fixes #10798: Enhance how docker compose driver path expands
Prior to this commit, the docker compose driver would _always_ path
expand a host volume no matter what. This is not always the correct
option, for example if that host volume is actually a reference to a key
inside a `volumes` hash instead of a path on disk. This commit changes
that by looking to see if the requested host volume is actually a
defined key inside the compose config, and if not, it will path expand
it like before. Otherwise it will leave the key "as is".
2019-04-29 16:14:37 -07:00
Brian Cain
4f80a9e6d5
Add test for requesting public ip range for docker network provider 2019-03-22 09:02:40 -07:00
Brian Cain
6bffdca972
Add beginning of connect network tests for docker provider 2019-03-21 16:06:24 -07:00
Brian Cain
88a18fe2c5
Add public network tests for docker provider 2019-03-21 16:06:11 -07:00
Brian Cain
82700d95b3
Ensure subnet is used if specified from user config options 2019-03-21 15:29:04 -07:00
Brian Cain
8c169714c5
Ensure variable names exist in method 2019-03-21 11:39:16 -07:00
Brian Cain
96a19aa00c
Fix how options to cli args are handled
Since options could also be defined as strings, convert it all to string
and compare those instead
2019-03-21 11:15:41 -07:00
Brian Cain
5215354d16
Fix missing docker error classes, and finish out initial #call tests 2019-03-21 10:50:45 -07:00
Brian Cain
1027636e41
Split up and rename unit tests for docker network operations 2019-03-20 15:14:39 -07:00
Brian Cain
eb75431c4a
Update docker driver and docker driver unit tests 2019-03-20 14:50:28 -07:00
Chris Roberts
623a1815ae Allow use of subnet option when defining private network with dhcp type 2019-03-19 14:35:40 -07:00
Chris Roberts
670bef6596 Allow custom subnet to be provided when private network type is dhcp 2019-03-19 14:20:14 -07:00
Chris Roberts
afb6c20581 Fix option mask to be expected netmask 2019-03-19 14:03:03 -07:00
Chris Roberts
a1c7eec441 Include synchronization as the environment lock is per process only 2019-03-19 13:46:14 -07:00
Chris Roberts
a645ce3c25 Docker provider networking support updates
Use `mask` option for defining subnet on network configuration. Allow
options to be passed through using hash scoping and docker_network and
docker_connect prefixes. Enable public networks. Allow configuration
to define pre-existing networks by name.
2019-03-19 11:44:33 -07:00
Chris Roberts
1224622387 Remove container inspection caching and Exception rescue
Container inspection is caching data on first lookup. This will
result in incorrect data being returned on subsequent lookups if
a different `cid` value is provided. Also removed rescue of
the `Exception` class as this generally should never happen; rescue
of StandardError will be enough.
2019-03-19 11:44:22 -07:00
Chris Roberts
c251e090b3 Remove Mutex for synchronization. Environment#lock satisfies requirement. 2019-03-19 11:44:02 -07:00
Brian Cain
6664936c0b
Make ignored vagrant network options a constant 2019-03-12 10:40:58 -07:00
Brian Cain
5ed5868067
Inspect networks before creating new ones
This commit updates the behavior of how the docker provider creates new
docker networks. It looks at each existing network to see if the
requested subnet has already been configured in the docker engine. If
so, Vagrant will use that network rather than creating a new one. This
includes networks not created by Vagrant. Vagrant will not clean up
these networks if created outside of Vagrant.
2019-03-12 10:36:57 -07:00
Brian Cain
b78dada2c7
Fix docker driver handling cli flags
Make opts argument set to nil instead of splat to make Travis Ruby 2.3
happy
2019-03-05 10:57:05 -08:00
Brian Cain
cccbedf4ce
Update how docker network handles processing options to cli arguments
Add an "ignored option" array rather than a big if-statement expression
2019-03-04 14:19:40 -08:00
Brian Cain
953a380371
Fix how Vagrant assigns cli arguments for the create command
This commit inlines the flag assignments so that arguments are properly
assigned to flags rather than arguments to the subcommand.
2019-03-04 13:44:21 -08:00
Brian Cain
efb9fd7b65
Move strings into locales file 2019-03-04 13:33:08 -08:00
Brian Cain
a1b48ed1bb
Raise proper class if invalid options given for docker network 2019-03-04 13:17:14 -08:00
Brian Cain
0b28580105
Move out cli argument generation to own function 2019-03-04 10:33:24 -08:00
Brian Cain
81fa7036be
Rename cli argument method 2019-03-04 10:28:49 -08:00
Brian Cain
6c7c74be5a
Fix if statement from = to == 2019-03-04 10:28:05 -08:00
Brian Cain
4080f9e64d
Log warning if docker network inspect fails to return json 2019-03-04 10:25:10 -08:00
Brian Cain
5adffb608d
Only allow private_network for docker network provider 2019-03-01 16:34:43 -08:00
Brian Cain
29696b0f73
Allow for ipv6 networks in docker 2019-03-01 16:20:16 -08:00
Brian Cain
000457a012
Update how docker network provider creates networks
This commit updates the docker network provider to only create networks
by subnet rather than per-container.
2019-03-01 16:07:53 -08:00
Brian Cain
c20de9044d
Log information if unsupported docker network option is provided 2019-03-01 08:34:43 -08:00
Brian Cain
4a0f1a0a33
Update docker network action to auto-generate cli flags
This commit updates the docker network behavior to auto-generate the
docker network command flags from Vagrants network config option.
2019-03-01 08:34:43 -08:00
Brian Cain
b5a092397f
Add new function for handling vagrant options to docker network cli
flags
2019-03-01 08:34:43 -08:00
Brian Cain
dc5f8c66f2
Add todo comment for future fixup 2019-03-01 08:34:43 -08:00
Brian Cain
4dc5f7c330
Add basic ability to configure some networks for containers 2019-03-01 08:34:43 -08:00
Brian Cain
e860c7709d
Begin to setup and configure docker networks for containers 2019-03-01 08:34:43 -08:00
Brian Cain
8013d8d5ef
Move around Network setup action for docker provider 2019-03-01 08:34:43 -08:00
Brian Cain
63ba0f9964
Add DestroyNetwork action to docker provider 2019-03-01 08:34:43 -08:00
Brian Cain
349cc5ddac
Add placeholder network destroy action for docker 2019-03-01 08:34:43 -08:00
Brian Cain
a336aa687c
Add logger and start to iterate over networks in config 2019-03-01 08:34:43 -08:00
Brian Cain
bed653eeb4
Autoload and use Network action on up 2019-03-01 08:34:43 -08:00
Brian Cain
67ea15126d
Make opts var optional for docker driver methods 2019-03-01 08:34:43 -08:00
Brian Cain
627251a307
Add basic docker network action 2019-03-01 08:34:43 -08:00
Brian Cain
ec2e0380ee
Add basic docker driver methods for docker network subcommand 2019-03-01 08:34:43 -08:00
Brian Cain
4c61eaa933
Fixes #10643: Ensure paths are properly expanded when comparing synced folders
Prior to this commit, the docker action would attempt to compare and
validate synced folders based on their string value, rather than their
actual path value. This commit updates that by path expanding the mounts
when comparing a containers synced folders.
2019-02-04 11:15:40 -08:00
Brian Cain
94bb50fa7e
Add test for syncing folders with docker provider 2018-10-17 14:14:27 -07:00
Martin Jonas
238338d803
Deterministic host VM synced folder location for Docker provider to prevent broken sync after host VM shutdown
Fix for #10282
2018-10-17 11:28:24 -07:00
Brian Cain
4612619dc4
Fixup docker config update 2018-09-19 10:52:59 -07:00
Oleksiy Protas
166fe374b6
More explicit logging and 'dockerfile' option support 2018-09-19 10:25:37 -07:00
Oleksiy Protas
cbc69f5158
Build from git operation for docker 2018-09-19 10:24:09 -07:00
Oleksiy Protas
de6a1794c7
Config, validation and test 2018-09-19 10:24:09 -07:00
Oleksiy Protas
8d1b5fc1c9
Docu changes for building Docker images from git 2018-09-19 10:24:05 -07:00
Brian Cain
c2cff0dc07
Merge pull request #10100 from briancain/DOCKER-TOOLBOX
Convert windows paths for volume mounts on docker driver
2018-08-17 15:08:59 -07:00
Brian Cain
5d2d784ae7
(#9085) - Add test for converting windows paths
This commit adds a test for checking that a windows path for mounting a
volume in a container is properly converted into something that's
usable.
2018-08-08 10:30:04 -07:00
Matthew Olenik
428eb3ed93
Support Docker volume consistency for synced folders
Adds the `docker_consistency` option, which sets the Docker volume
consistency level. This can be used to greatly improved synced folder
performance, especially on macOS.

See for details: moby/moby#31047
2018-07-27 15:16:39 -07:00
Brian Cain
79e535a7ee
(#9622) Use SafeExec for docker-exec
This commit uses the internal helper SafeExec rather than using the
Kernel class directly. It also adds a test to ensure that if the `-t`
option is used, it will call SafeExec.
2018-05-02 14:23:50 -07:00
Isaac Freeman
de71626922 docker: use Kernel.system for docker-exec when -t is given 2018-04-18 17:50:47 -04:00
Josh Soref
1a5ddea9f4 Spelling fixes
* account
* addresses
* administrator
* afterwards
* because
* bridgeable
* capabilities
* capability
* checksum
* configuration
* configuration for
* configure
* criteria
* delimited
* delivered
* derivatives
* description
* detect
* directory
* display
* downloading
* during
* electric
* enabling
* encountered
* equivalent
* executable
* executed
* hashicorp
* hypervisor
* hyphens
* implementation
* incorporate
* inheritance
* initialize
* instance
* instead
* interactions
* invocable
* machine
* maximum
* message
* mounting
* overridden
* overwrite
* paramiko
* preparing
* provides
* provisioning
* recursively
* requested
* resetting
* retryable
* running
* satisfied
* searching
* sometimes
* specified
* successfully
* synced folders
* unauthorized
* underlying
* userprofile
* vagrant
* vagrantfile
* variable
* various
* version
* virtual
* windows
2018-03-14 14:41:04 +00:00
mihab
03178bbe04 Fixes #9085: Cannot up a machine with Docker Toolbox and Git Bash 2018-03-01 21:38:39 +01:00
Dimitrios Kouzis-Loukas
51716c5ef0 fix for issue 8608 2017-08-27 23:56:47 -04:00
Chris Roberts
f660c19084 Error when compose and force_host_vm are enabled together 2017-08-22 11:36:26 -07:00
Chris Roberts
1c763cf5e6 Expand relative volume paths for compose on current cwd 2017-08-21 13:26:19 -07:00
Chris Roberts
3b4901a5b5 Split compose links if string values 2017-07-31 14:23:50 -07:00
Dimitrios Kouzis-Loukas
34d8ffb9b2 Fixing vagrant ssh issue 8705
Fixing vagrant issue https://github.com/mitchellh/vagrant/issues/8705
2017-06-21 10:23:34 -04:00
Harry Weppner
250e74cb79 fix check for docker-compose 2017-06-08 11:09:41 -07:00
Chris Roberts
27ca3ef831 Convert Windows paths in volumes if detected 2017-05-12 15:11:10 -07:00
Chris Roberts
36ecd40c52 Support optional detach and pass blocks through to execution. 2017-05-12 15:09:30 -07:00
Chris Roberts
6096bb299b Only set image if option given. Do not apply when setting build options. 2017-05-12 15:09:30 -07:00
Chris Roberts
42c9042221 Deep merge configuration settings and set any extra options 2017-05-12 15:09:30 -07:00
Chris Roberts
9242a69545 Allow direct set of composition and ensure basic types are used 2017-05-12 15:09:30 -07:00
Chris Roberts
4673bbb907 Properly define service build within composition. Full cleanup on destroy. 2017-05-12 15:09:30 -07:00
Chris Roberts
b333e5cd82 Fix argument construction when adding dockerfile path
Fixes #7914
2017-05-12 15:09:30 -07:00
Chris Roberts
d1c1c175a0 Support modifications of composition outside services 2017-05-12 15:09:30 -07:00
Chris Roberts
d4bfade19f Include documentation on accessor in docker provider configuration 2017-05-12 15:09:30 -07:00
Chris Roberts
deba93ce5c Add optional support for docker-compose
Adds configuration switch to enable using docker-compose
to create and manage docker containers.
2017-05-12 15:09:30 -07:00
Chris Roberts
5d83c03bfc Properly handle synced folders in docker provider on WSL 2017-05-12 14:05:12 -07:00
Chris Roberts
ffc6e3e282 Merge pull request #8566 from chrisroberts/fix/docker-ssh
Fall back to old style ssh info lookup in docker provider
2017-05-08 10:14:51 -07:00
Chris Roberts
88dfe18a3f Fall back to old style ssh info lookup in docker provider
If ssh information cannot be properly extracted from within
the NetworkSettings data, fallback to original ssh information
implementation

Fixes #8552
2017-05-05 14:02:05 -07:00
Chris Roberts
e5e0274ef5 Update hyperv and docker providers to raise exception on SSH when machine is not ready
This makes the behavior of the docker and hyperv provider consistent with the
virtualbox provider by raising an error on ssh actions if the machine is not
created or not running.

Fixes #8508
2017-05-05 14:01:12 -07:00
Chris Roberts
05b6cdab6c Do not force docker host VM on Darwin or Windows 2017-04-03 14:48:14 -07:00
Chris Roberts
74ad90d8e0 Merge pull request #7840 from pstengel/bugfix/7651
Do better at finding ssh_info for Docker
2017-04-03 14:41:50 -07:00
Chris Roberts
6f578590a9 Skip forwarded port if disabled in docker provider 2017-03-09 10:28:41 -08:00
Paul Stengel
d98c5b8c00 Do better at finding ssh_info for Docker 2017-01-05 17:41:39 -05:00
Theron Boerner
391c5be08e Remove --interactive flag from Docker command
See: GH-7597. Due to the childprocess gem setting STDIN to a pipe,
Docker will fail as it requires STDIN to be a TTY if run with
--interactive.
2016-10-05 14:38:20 -05:00
Seth Vargo
e270e7df27
provider/docker: Add -u flag to exec 2016-05-31 20:05:27 -04:00
Seth Vargo
cfac24779c
provider/docker: Separate -i and -t flags for exec 2016-05-31 20:05:27 -04:00
Seth Vargo
bf96b3348b
provider/docker: Add docker-exec command
This adds a new core command, `docker-exec`, which allows the user to
exec into an already-running container.

- Fixes #6566
- Fixes #5193
- Fixes #4904
- Fixes #4057
- Fixes #4179
- Fixes #4903
2016-05-31 20:05:26 -04:00
Seth Vargo
38f23fe001
providers/docker: Allow TCP and UDP ports on same number
This commit changes the way ports are aggregated in the Docker provider.
Previously ports were aggregated by their "number", but that is not a
truly unique representation. Instead, the protocol is now taken into
account when generating the port map.

Fixes GH-5527
2016-05-30 17:23:44 -04:00
Ray Ruvinskiy
e42f346b1d
Make start action run provisioners if VM is running
Previously, there was no one gesture that would start a VM if it was not
running and run the appropriate provisioners regardless of its original
state. `vagrant up` did nothing if the VM was running, while
`vagrant provision` did nothing if the VM was not running.

Change the semantics of `vagrant up`, via the start actions of the providers,
to go through the provisioning logic even if the VM is already running.
The semantics of `run: "once"` vs `run: "always"` are respected.

Tested with the VirtualBox provider but not the others.

Resolves #4421
2016-05-27 19:00:33 -04:00
Seth Vargo
8c11b537ba
Allow Mac/Windows users to use Docker native 2016-05-27 17:36:07 -04:00
till
647bd6114c Change: disable the linux switch (Docker for Mac/Windows, etc.) 2016-05-08 21:35:12 +02:00
Seth Vargo
825bd6d5ef Run provisioner cleanup tasks before destroying the VM 2015-11-19 11:14:31 -08:00
Mitchell Hashimoto
bac5d039db providers/docker: pull setting, default false [GH-5932] 2015-07-15 11:08:01 -07:00
Mitchell Hashimoto
f1618f5ec8 providers/docker: don't remove image on reload for build cache 2015-07-09 14:23:26 -06:00
Adrian Guenter
9bdefb5c59 Don't destroy built Docker image on reload 2015-07-09 16:15:56 -04:00
Mitchell Hashimoto
9dd87b289e providers/docker: validate config after HandleBox [GH-5667] 2015-07-08 17:45:32 -06:00
Mitchell Hashimoto
be21604d45 providers/docker: style on custom Dockerfile 2015-07-08 16:07:57 -06:00