5

I am deploying an application in an ubuntu instance of OCI.

I have a docker-compose file with named volumes for this. There is a volume specification at the top-level and that named volume is mentioned in the nested-level under the service.:

version: '3.2'
services:
  minio:
    image: minio/minio
    restart: always
    command: server /data
    ports:
    - 9200:9000
    volumes:
    - minio-data:/data

volumes:
  minio-data:
    driver_opts:
      type: none
      device: /mydir/data/minio-data
      o: bind

But when doing docker-compose up, it fails to bring the container up with an error:

Creating docker_minio_1    ... error

ERROR: for minio  Cannot start service minio: error while mounting volume '/var/lib/docker/volumes/docker_minio-data/_data': failed to mount local volume: mount /mydir/data/minio-data:/var/lib/docker/volumes/docker_minio-data/_data, flags: 0x1000: no such file or directory

ERROR: Encountered errors while bringing up the project.

But if i do it in the following way, it works.:

version: '3.2'
services:
  minio:
    image: minio/minio
    restart: always
    command: server /data
    ports:
    - 9200:9000
    volumes:
    - /mydir/data/minio-data:/data

Can anyone help to understand what is the difference between the two?

And, how can i fix the problem in first method?

AnjK
  • 2,887
  • 7
  • 37
  • 64

0 Answers0