eywalker / nvidia-docker-compose

Simple wrapper for docker-compose to use GPU enabled docker under nvidia-docker
225 stars 29 forks source link

Breaks relative pathing for volumes #4

Closed Wildcarde closed 7 years ago

Wildcarde commented 7 years ago

Docker compose will allow for relative pathing of volume mounts, however this seems to break when using nvidia-docker-compose. Overall not a huge problem but it's a bit of a nuisance since the compose file becomes less portable.

eywalker commented 7 years ago

That's quite interesting, because I use relative paths in volume mounts when using nvidia-docker-compose myself. Would you mind posting an example docker-compose.yml that you use that gives you this issue?

Wildcarde commented 7 years ago

Sure not a problem, this docker file files to run in nvidia-docker-compose (the 'worker' requires nvidia-docker)

version: '2'

services:
  redis:
    image: 'redis:3.0-alpine'
    command: redis-server --requirepass devpassword
    volumes:
      - 'redisdata:/var/lib/redis/data'
    ports:
      - '6379:6379'
  handibot:
    build:
      context: .
      dockerfile: handibot.Dockerfile
    links:
      - redis
    depends_on:
      - redis
    volumes:
      #- /non/relative/path:/host
      - ".:/host"
      #- /non/relative/path/nfsmount:/working
      -  /non/relative/local/test/mount:/working
  worker:
    build:
      context: .
      dockerfile: pythonworker.Dockerfile
    depends_on:
      - redis
    volumes:
      #- /non/relative/path:/host
      - ".:/host"
      #- /non/relative/path/nfsmount:/working
      -  /non/relative/local/test/mount:/working

volumes:
  redisdata:

related error:

ERROR: for handibot Cannot create container for service handibot: Invalid bind mount spec "7e15cde9e95e846b70a211e50a3cc1283b7d4e88ae3cb61448bd7f6cde423b5e:[/host]:rw": Invalid volume destination path: '[/host]' mount path must be absolute.

If I swap the relative path above from ".:/host" to a non relative path all works as expected.

vs. this much easier one that is working as expected (via docker-compose, this has not been tested in nvidia-docker-compose):

version: '2'

services:
  tensorflow:
    build:
      context: .
      dockerfile: anaconda.Dockerfile
    volumes:
      - ".:/host"
    ports:
      - "9000:9000"
      - "6006:6006"
Wildcarde commented 7 years ago

Actually I may have figured this out. I didn't remove and rerun the containers after changing the definition of /host and that seems to have caused this issue.

eywalker commented 7 years ago

Glad to hear your issue was resolved.