Commit Graph

255 Commits

Author SHA1 Message Date
Chris Bednarski b9fcdc400a Merge branch 'master' into f-docker-dns-config 2015-11-18 10:31:06 -08:00
Carlos Diaz-Padron 4a6c3d773d Nest Docker driver auth under object 2015-11-18 01:37:42 -08:00
Carlos Diaz-Padron de6c06d332 De-nest docker registry auth and reformat related doc 2015-11-17 23:32:57 -08:00
Chris Bednarski c80cf651e8 Merge branch 'master' into f-docker-dns-config 2015-11-17 21:43:04 -08:00
Chris Bednarski 7b25c9b4d9 Change dns_servers and dns_search_domains from comma-delimited strings to lists 2015-11-17 21:41:00 -08:00
Chris Bednarski c851ae67c7 Change error check to contains instead of == 2015-11-17 21:36:23 -08:00
Chris Bednarski 563e1aff56 Renamed some things so it's more apparent that reserved and dynamic port mapping have very similar code 2015-11-17 21:34:07 -08:00
Chris Bednarski 8705ea07a4 Remove \n since this is added by the logger 2015-11-17 21:17:51 -08:00
Chris Bednarski 5ac6664c46 Purge existing container during Start() 2015-11-17 20:50:14 -08:00
Chris Bednarski 0e1fe2373a Log container name and labels 2015-11-17 20:04:10 -08:00
Chris Bednarski 640af994ca Added a randomized alloc id for tests so container names don't collide 2015-11-17 19:45:33 -08:00
Chris Bednarski 9a7adb9eb3 Fix guards for docker port mapping and change dummy dynamic ports to real ports (0 is not a valid port) 2015-11-17 19:21:36 -08:00
Chris Bednarski d098acef90 Fix guard for port maps not being specified 2015-11-17 18:16:01 -08:00
Chris Bednarski 122220a424 Merge branch 'master' into f-docker-any-network 2015-11-17 17:22:13 -08:00
Chris Bednarski 9cad290b18 Merge pull request #436 from hashicorp/f-docker-cleanup
Cleanup docker driver
2015-11-17 17:13:17 -08:00
Chris Bednarski b22b5eb3aa Inline err assignment 2015-11-17 17:12:45 -08:00
Chris Bednarski a2f4188246 Streamline reading boolean values from the driver / job config 2015-11-17 16:58:23 -08:00
Chris Bednarski 67ee502acb Added missing linebreaks for log.Printf calls 2015-11-17 16:49:01 -08:00
Chris Bednarski 43aaf94383 Do Itoa once so line items are simpler 2015-11-17 16:31:47 -08:00
Chris Bednarski ffd3f114dd Merge branch 'docker-allow-to-add-labels' of https://github.com/fernandezvara/nomad into f-docker-labels 2015-11-17 16:02:42 -08:00
Chris Bednarski 3b7c252090 Improve phrasing in log messages 2015-11-17 15:17:44 -08:00
Alex Dadgar 7551a263c5 Merge pull request #389 from achanda/name
Set a name for the container
2015-11-17 15:07:23 -08:00
Chris Bednarski 629cdd6baa Clean up extraneous variables 2015-11-17 14:51:38 -08:00
Chris Bednarski 7f117b3b55 That's not a declaration 2015-11-17 14:27:58 -08:00
Chris Bednarski 89c6f56059 Remove restrictions from docker networking mode; we assume users know what they are doing 2015-11-17 14:25:10 -08:00
Chris Bednarski f2e8357e4a Merge branch 'master' into f-docker-cleanup 2015-11-17 14:20:29 -08:00
Antonio Fernández f7f83ee81c allow to set labels on docker containers 2015-11-17 14:12:49 +01:00
Carlos Diaz-Padron 77923255b4 Add hostname parameter to Docker driver 2015-11-16 22:44:44 -08:00
Chris Bednarski bac9bd60dc Improve logging and DRY some of the port mapping code 2015-11-16 19:55:49 -08:00
Diptanu Choudhury 03847dd65a Addressed some review comments 2015-11-16 22:29:06 -05:00
Chris Bednarski 714e1b52d1 Change logging port as %d to logging port.Value 2015-11-16 16:05:28 -08:00
Chris Bednarski 9f40143684 Merge branch 'master' into f-port-labels 2015-11-16 16:02:38 -08:00
Alex Dadgar 82f51601db Track Task State in the client and capture Wait results 2015-11-16 15:14:21 -08:00
Diptanu Choudhury c5102975e3 Made the code more DRY 2015-11-16 13:10:57 -08:00
Diptanu Choudhury e40229aed6 Fixed the docker auth config 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 7d44725370 Adding comments to fields in the docker driver config 2015-11-16 13:10:57 -08:00
Alex Dadgar fa60d86fe5 mapstructure close quotes 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 9d76572831 Making sure that there is only one port_map block in the docker driver config 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 78a0f82bc5 Making the config for drivers public 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 4e05b27111 Implemented port labeling and driver configs 2015-11-16 13:10:57 -08:00
Chris Bednarski 2f05a15aa5 Expose mapped ports 2015-11-12 17:23:04 -08:00
Chris Bednarski 7f3a2595af Change Docker fingerprinter to INFO and not error when the connection to the daemon fails; we simply assume docker isn't there. 2015-11-10 16:18:52 -08:00
Chris Bednarski e5688620e4 Changed behavior for Docker ENV
- Docker ENV variables now work the same way in production, dev, and test
- Docker ENV variables are *ignored* if docker.endpoint is present in the Nomad config file
- Remote tests now work correctly
2015-11-10 15:54:31 -08:00
Alex Dadgar bb9f2aa66c Docker privileged checks if host enabled it 2015-11-06 10:38:54 -08:00
Alex Dadgar 149366b89e Merge pull request #390 from the-control-group/f-docker-driver-options
Expanded docker driver options
2015-11-06 10:32:54 -08:00
Abhishek Chanda 94a4d00f4b Set a name for the container. 2015-11-06 03:33:57 +00:00
Shiem Edelbrock 5e2430de74 Fix build
returned wrong value, and forot a ":" :/
2015-11-05 17:57:51 -08:00
Shiem Edelbrock 1169bef912 Updated `priviliged` option, added client `priviliged` option
- Added error checking on priviliged mode.
- Added `docker.privileged.enabled` to client config/fingerprint
2015-11-05 16:40:20 -08:00
Alex Dadgar f9fd83c696 Merge fix 2015-11-05 13:46:02 -08:00
Shiem Edelbrock c174f4819b Added task configuraton options for docker driver
- Added `priviliged` option to task config to allow containers to run in
 priviliged mode.
- Added `dns-servers` option to task config to allow containers to use
  custom DNS servers
- Added `search-domains` option to task config to allow containers to
  use custom dns search domains
- Added authentication options (under key namespace `auth.*`) to allow
  authentication on a task level for docker remote.
- Updated site docs to reflect changes
2015-11-05 10:47:41 -08:00
Kenjiro Nakayama 1e47dd4c7d Apply SELinux label to allocate directory of docker driver 2015-11-05 09:06:22 +09:00
Alex Dadgar c7fd8993c1 Change two helper functions to be methods 2015-10-15 17:47:14 -07:00
Alex Dadgar a0d9f8dd33 Remove debug lines 2015-10-15 17:30:40 -07:00
Alex Dadgar 2f6a279d09 Docker alloc dir tests and test fixes 2015-10-15 16:59:08 -07:00
Alex Dadgar 1d15f6eda6 Bind alloc dir and task local dir to docker containers and parse args correctly 2015-10-15 16:40:07 -07:00
Abhishek Chanda dbe9fa9f27 Run gofmt on the docker driver 2015-10-13 23:21:16 +00:00
Abhishek Chanda 36dc8a5a18 Do not default to a network mode
Makes the driver error out when a wrong or un-supported
network_mode is used
2015-10-13 10:57:21 -07:00
Alex Dadgar a4035050e8 Change Docker/Rkt to set driver to 1 not true for consistency 2015-10-12 13:15:37 -07:00
Chris Bednarski a9f1f64199 Use DefaultDockerHost from fsouza upstream 2015-10-08 12:35:19 -07:00
Chris Bednarski 3c170b70ee Remove panic -- client is nil when there is an error 2015-10-06 19:09:59 -07:00
Chris Bednarski a4c3da6c0c Merge branch 'master' into b-docker-port 2015-10-06 17:54:32 -07:00
Chris Bednarski d046858057 Support boot2docker or VM for dev/test 2015-10-06 17:53:05 -07:00
Chris Bednarski 88bb01ab6f Fingerprint test should now behave correctly when the executor is not installed; fix some go vet issues 2015-10-06 16:33:02 -07:00
Chris Bednarski 8cd34d3947 Use docker.NewClient; move dockerClient before it's used 2015-10-06 16:26:31 -07:00
Chris Bednarski 5e73e746dc Merge branch 'docker-use-environment' of https://github.com/carlosdp/nomad into b-docker-port 2015-10-06 15:36:06 -07:00
Carlos Diaz-Padron aaddc7bf6c Use environment to connect to Docker by default
Uses the environment definition for docker by default. Docker will
default to the unix/tcp socket if the environment is not set.
2015-10-04 12:59:54 -07:00
Alex Dadgar faf8002d2d go-fmt 2015-10-02 10:54:04 -07:00
Abhishek Chanda 3751b46673 Make sure createHostConfig is called only once
The second call discards any mods to port binding or
network type

Fixes #185 and #196
2015-10-02 10:43:37 -07:00
Abhishek Chanda 0cb649bd5f Enable setting networking mode for docker
This patch enables setting networking mode for the docker
driver. This does not handle the `container` mode.
Closes #175
2015-10-01 18:52:41 -07:00
Armon Dadgar 6ff19853ef docker: check for missing unix socket 2015-09-27 17:49:58 -07:00
Alex Dadgar a45f9f2e71 Pull task environments into their own type to be reusable across drivers and executors 2015-09-27 17:37:24 -07:00
Alex Dadgar a7eebcbd5b merge fixes 2015-09-27 17:37:24 -07:00
Chris Bednarski 162247ffbe Correct implementation of config check for container and image cleanup; moved into Start and Open because handle does not have the config object 2015-09-27 13:59:38 -07:00
Chris Bednarski 9455370d8e Merge branch 'master' into f-docker-config-cleanup 2015-09-26 21:52:02 -07:00
Chris Bednarski 5678859752 Add configuration option for whether Nomad will clean up containers and images when they are no longer used 2015-09-26 18:53:15 -07:00
Chris Bednarski 79488baa4d Add all containers when searching for images that are still in used, since the container using the image may be stopped 2015-09-26 18:51:36 -07:00
Chris Bednarski af314b0f4d Log an info when an image can't be removed because it's still in use 2015-09-26 00:34:57 -07:00
Chris Bednarski 5632a33036 Use env.Get, remove sha256 checks, and change from regexp to strconv to test for int 2015-09-25 23:55:01 -07:00
Chris Bednarski 7021ac3ce8 Add docker 'command' to docs; cleanup some comments 2015-09-25 23:28:23 -07:00
Chris Bednarski 23407c54af Replace docker version and docker ps with native calls; no more exec! 2015-09-25 23:13:40 -07:00
Chris Bednarski 72cd22347f Docker kill now exits with an error, as expected 2015-09-25 22:43:19 -07:00
Chris Bednarski 0c31a83783 Go native for docker API calls 2015-09-25 20:01:03 -07:00
Chris Bednarski efb7c409bb Improve handling of tagged docker images
- Converted Start() to use docker native client throughout
- Better handling of latest vs. tagged images
    - We can now support multiple versions of an image
    - We will now not download a tag if we already have it
2015-09-25 18:22:10 -07:00
Chris Bednarski d2aa4fd53c Merge pull request #104 from hashicorp/f-docker-static-ports
Add static (reserved) ports for docker
2015-09-24 15:44:41 -07:00
Chris Bednarski 40ce6ece41 Get only one version of a docker container 2015-09-24 14:07:28 -07:00
Chris Bednarski f8e8084c71 Rename containerConfigForTask to createContainer to mirror the docker api call; other helper functions will follow this convention too 2015-09-24 00:00:46 -07:00
Chris Bednarski a071bb6d59 Rename containerConfig to hostConfig since there are two types of container configs 2015-09-23 23:57:04 -07:00
Chris Bednarski 9ff0e88d33 Added static / reserved port allocations to docker 2015-09-23 23:45:34 -07:00
Chris Bednarski 1978be24d0 Format as string instead of casting to string 2015-09-23 19:29:53 -07:00
Chris Bednarski e413c6f9d2 Support mapped ports and labelled ports for docker 2015-09-23 18:19:01 -07:00
Chris Bednarski 1654d08fca Add docker ports; change to uppercase examples and tests 2015-09-23 18:01:08 -07:00
Chris Bednarski 9067b2594f Added environment variables to docker 2015-09-22 23:12:24 -07:00
Chris Bednarski 09249d877c Removed comment that's no longer relevant 2015-09-22 20:11:07 -07:00
Chris Bednarski da93d4a30f Change error to err to be consistent with other usage 2015-09-11 10:26:33 -07:00
Chris Bednarski 4f83bc7090 Fix typos 2015-09-10 11:35:03 -07:00
Chris Bednarski 2ccad3d6e8 Change panic to a more helpful message 2015-09-09 19:04:06 -07:00
Chris Bednarski 237bf5f68e Merge branch 'f-driver-config' into f-docker-resource-constraints 2015-09-09 18:47:35 -07:00
Chris Bednarski a695e311dc Replace logging and config with DriverContext, which allows us to expand the dependency injection without changing the interface 2015-09-09 18:06:23 -07:00
Chris Bednarski 9965d28a22 Add logger to the dockerHandle created by Open() 2015-09-09 13:43:28 -07:00
Chris Bednarski a731a84136 Cleanup based on PR feedback
- Add validation that Resources.MemoryMB and Resources.CPU have non-zero values
- Change log calls to use logger whenever possible
- Change log format to add colon after driver.docker
2015-09-09 13:35:10 -07:00
Chris Bednarski b70b852662 Added preliminary resource constraints for docker; CPU and Memory 2015-09-09 01:08:31 -07:00
Chris Bednarski 4eb8fc5188 Added config to drivers; needed for docker driver to get the socket endpoint 2015-09-08 12:43:02 -07:00
Chris Bednarski 813f905a1c Removed debug logging 2015-09-03 21:08:14 -07:00
Chris Bednarski c483036e16 Added tests for docker, improved logging, and fixed a few bugs 2015-09-03 21:00:16 -07:00
Chris Bednarski b9ceb69683 Added initial implementation for the docker driver; tests pending 2015-09-03 12:35:22 -07:00