lib/hoosegow/docker.rb in hoosegow-1.2.5 vs lib/hoosegow/docker.rb in hoosegow-1.2.6
- old
+ new
@@ -78,23 +78,25 @@
# image - The name of the image to start the container with.
#
# Returns nothing.
def create_container(image)
@container = ::Docker::Container.create @container_options.merge(
- :StdinOnce => true,
- :OpenStdin => true,
- :Volumes => volumes_for_create,
+ :StdinOnce => true,
+ :OpenStdin => true,
+ :HostConfig => {
+ :Binds => volumes_for_bind
+ },
:Image => image
)
callback @after_create
end
# Public: Start a Docker container.
#
# Returns nothing.
def start_container
- @container.start :Binds => volumes_for_bind
+ @container.start
callback @after_start
end
# Attach to a container, writing data to container's STDIN.
#
@@ -198,22 +200,10 @@
else
nil
end
end
- # Private: Generate the `Volumes` argument for creating a container.
- #
- # Given a hash of container_path => local_path in @volumes, generate a
- # hash of container_path => {}.
- def volumes_for_create
- result = {}
- each_volume do |container_path, local_path, permissions|
- result[container_path] = {}
- end
- result
- end
-
- # Private: Generate the `Binds` argument for starting a container.
+ # Private: Generate the `Binds` argument for creating a container.
#
# Given a hash of container_path => local_path in @volumes, generate an
# array of "local_path:container_path:rw".
def volumes_for_bind
result = []