luemob
luemob

Reputation: 21

Docker-compose volumes to map to external usb drive

I would like to map an external usb drive in my docker-compose.yml I used the following:

 volumes:
 external: true
  #- bitcoin-data:/data original line commented out to attempt next line
   - bitcoin-data:/run/media/directory name/external drive name/docker-base

However when running docker-compose up I receive the following:

ERROR: yaml.parser.ParserError: while parsing a block mapping
in "./docker-compose.yml", line 5, column 5
expected <block end>, but found '<scalar>'
in "./docker-compose.yml", line 16, column 8

Line 5 refers to the image and Line 16 refers to the external drive I am attempting to save data destination.

Upvotes: 2

Views: 1638

Answers (1)

toshiro92
toshiro92

Reputation: 1344

You cannot add a list in a yaml file just after a variable, that's why you have this error. If you want to add the external parameter, you will have to put the volumes's path into you container section, and the external setting into the volumes section, like:

services:
  yourcontainer:
    [...]
    volumes:
        - bitcoin-data:/run/media/directory name/external drive name/docker-base

volumes:
  bitcoin-data:
    external: true

Upvotes: 1

Related Questions