Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2019.08.26
2019.08.28
9 changes: 5 additions & 4 deletions container_shell/lib/dockage.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ def mounts(mount_dict):
"""
the_mounts = []
for local_dir, container_dir in mount_dict.items():
a_mount = docker.types.Mount(source=local_dir,
target=container_dir,
type='bind')
the_mounts.append(a_mount)
for mount_point in container_dir.split(','):
a_mount = docker.types.Mount(source=local_dir,
target=mount_point,
type='bind')
the_mounts.append(a_mount)
return the_mounts

#pylint: disable=R0913
Expand Down
3 changes: 3 additions & 0 deletions sample.config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ servers = 8.8.8.8,8.8.8.9
# containered environment. Omit this whole section to perform no host mounts.
[mounts]
/home=/home
# If you want the same host location mounted to multiple paths *inside* the
# container, seperaste those paths wtih a command like this
/some/host/path=/mnt/foo,/mnt/bar

# Limit the resources a container can use.
# Omit lines to put zero limits on that specific resource.
Expand Down
9 changes: 9 additions & 0 deletions tests/test_dockage.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ def test_objects(self):

self.assertEqual(mount_obj, expected)

def test_multiple_mounts(self):
"""``dockage`` 'mounts' parses a common, and mounts that path to multiple locations"""
mount_dict = {'/home': '/home/bob,/home/jill'}

mount_objs = dockage.mounts(mount_dict)
expected = [docker.types.Mount(source='/home', target='/home/bob', type='bind'),
docker.types.Mount(source='/home', target='/home/jill', type='bind')]

self.assertEqual(mount_objs, expected)

class TestContainerCommand(unittest.TestCase):
"""A suite of test cases for the ``container_command`` function"""
Expand Down