Skip to content

Guide to Editing the Docker Compose File

This guide explains how to edit the provided Docker Compose file to mount directories from your own user folders and describes the purpose of the example dataset mounts.


Overview

The Docker Compose file defines a service named segmentation_gym with the following key elements:

  • Image Building:
    The container is built from a specified Dockerfile in the current directory.

  • Runtime Settings:
    It uses NVIDIA runtime with GPU support.

  • Volume Mounts:
    Three directories are mounted from the host into the container.

  • Container Command:
    The container opens a bash shell on startup.


Volume Mounts Details

The Docker Compose file includes three volume mounts:

Note: These directories contain example datasets available from the gym website. Not all users may need these datasets.

  • A host directory is the folder on your computer (aka not created in the docker container) that you want to 'share' with the docker container. This is the source path in the compose file.

  • If you don't want to mount a certain directory, you can remove the corresponding section from the compose file. -- For example if I don't want to mount the my_segmentation_gym_datasets directory, I would remove the following section from the compose file:

    1
    2
    3
    - type: bind
      source: /home/sharon/gym/segmentation_gym/my_segmentation_gym_datasets
      target: /gym/my_segmentation_gym_datasets
    

  • my_segmentation_gym_datasets

  • Host Directory: /home/sharon/gym/segmentation_gym/my_segmentation_gym_datasets
  • Container Target: /gym/my_segmentation_gym_datasets

  • my_segmentation_gym_datasets_v5

  • Host Directory: /home/sharon/gym/segmentation_gym/my_segmentation_gym_datasets_v5
  • Container Target: /gym/my_segmentation_gym_datasets_v5

  • model_from_scratch_test_v5

  • Host Directory: /home/sharon/gym/segmentation_gym/model_from_scratch_test_v5
  • Container Target: /gym/model_from_scratch_test_v5

Note: These directories contain example datasets available from the gym website. Not all users may need these datasets.


How to Modify the Compose File

1. Changing the Mount Source

If you want to mount directories from your own folders (e.g., if your username is john), update the source paths. For example, change:

1
2
3
- type: bind
  source: /home/sharon/gym/segmentation_gym/my_segmentation_gym_datasets
  target: /gym/my_segmentation_gym_datasets
to
1
2
3
- type: bind
  source: /home/Jon/gym/segmentation_gym/my_segmentation_gym_datasets
  target: /gym/my_segmentation_gym_datasets

  • Just be sure that the folder you specify as the source path exists on your computer.
  • In this example /home/sharon/gym/segmentation_gym/my_segmentation_gym_datasets is the full path to a folder on my WSL2 Ubuntu machine.