Skip to content
This repository was archived by the owner on May 9, 2022. It is now read-only.

Update for new Docker API#17

Merged
claytono merged 2 commits into
masterfrom
volume-update
Apr 4, 2018
Merged

Update for new Docker API#17
claytono merged 2 commits into
masterfrom
volume-update

Conversation

@claytono
Copy link
Copy Markdown
Contributor

@claytono claytono commented Apr 3, 2018

Update volume mounts for new docker api

Docker Engine API has deprecated passing in options when starting the container and now expects all volumes/binds to be passed in when the container is created.

This also adds a spec test to verify that volume mounts are actually active by mounting a local directory into a container then having the container create a file in that directory, and having the test verify it was successfully created.

This adds a new spec test that will mount a local directory and have the
docker container launched create a file in that directory.  This is to
ensure that the volume mounts are operating as expected.
@claytono claytono requested a review from parkr April 3, 2018 16:59
Docker Engine API has deprecated passing in options when starting the
container and now expects all volumes/binds to be passed in when the
container is created
@parkr parkr requested a review from spraints April 3, 2018 17:02
Copy link
Copy Markdown
Contributor

@parkr parkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! @spraints is the original author of this and it would be helpful to have his final 👀 on this, though not strictly necessary. Feel free to try this out 👍


config = CONFIG.merge(
:Entrypoint => ['/usr/bin/touch', '/volume-test/test'],
:volumes => { '/volume-test' => test_dir + ":rw"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Barely remembering what is going on here... funny that this is :volumes instead of :Volumes – is that intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. The api is such that lower case keys are processed by hoosegow and the rest are passed through to the docker api.

@claytono claytono merged commit 4fd9567 into master Apr 4, 2018
@claytono claytono deleted the volume-update branch April 4, 2018 13:06
@spraints
Copy link
Copy Markdown
Contributor

spraints commented Apr 5, 2018

👍

dpmex4527 added a commit that referenced this pull request Aug 7, 2019
This adds a new spec test that will mount a local directory and have the docker
container launched copy the `/etc/hosts` file to that directory. This is to
ensure that volume mounts still work as expected (see #17) and that any custom
@container_options passed in to Hoosegow that use the `:HostConfig` key get
properly configured. In this case, we're testing that the `:ExtraHost` option
properly adds the list of hostname/IP mappings to the containers `/etc/hosts`
file.
dpmex4527 added a commit that referenced this pull request Aug 7, 2019
Activesupport's `deep_merge` hash method will recursively merge hashes so
that duplicate keys will not overwrite each other. #17 introduced a change
where we now configure volume binds at create time by using the `:HostConfig`
option to do this. This makes it so that any other custom docker option that
uses `:HostConfig` (such as `:ExtraHosts`) will get overwritten in the .merge
in favor of the default volume `:Bind` configuration.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants