Tri
Tri

Reputation: 344

docker compose up with customized volumes on azure container instance

I am trying to docker compose up to Azure Container Instances, but nothing shows up, and no docker container is created. As below

CCSU_ACA_COMP+tn3877@CCSU-ND-909264 MSYS ~/source/cab/cab-deployment (master)
$ docker compose up

CCSU_ACA_COMP+tn3877@CCSU-ND-909264 MSYS ~/source/cab/cab-deployment (master)
$ docker ps
CONTAINER ID        IMAGE               COMMAND             STATUS              PORTS

Following is my docker-compose.yaml file

version: "3.8"

services:
    cassandra:
        image: cassandra:4.0.0
        ports:
            - "9042:9042"
        restart: unless-stopped
        volumes:
            - hi:/home/cassandra:/var/lib/cassandra
            - hi:/home/cassandra/cassandra.yaml:/etc/cassandra/cassandra.yaml
        networks:
            - internal

    cassandra-init-data:
        image: cassandra:4.0.0
        depends_on:
            - cassandra
        volumes:
            - hi:/home/cassandra/schema.cql:/schema.cql
        command: /bin/bash -c "sleep 60 && echo importing default data && cqlsh --username cassandra --password cassandra cassandra -f /schema.cql"
        networks:
            - internal

    postgres:
        image: postgres:13.3
        ports:
            - "5432:5432"
        restart: unless-stopped
        volumes:
            - hi:/home/postgres:/var/lib/postgresql/data
        networks:
            - internal
    
    rabbitmq:
        image: rabbitmq:3-management-alpine
        ports:
            - "15672:15672"
            - "5672:5672"
        restart: unless-stopped
        networks:
            - internal

volumes:
    hi:
    driver: azure_file
    driver_opts:
        share_name: docker-fileshare
        storage_account_name: cs210033fffa9b41a40
            
networks:
    internal:
        name: cabvn

I have an Azure account and a Fileshare as below enter image description here

I am suspecting the volume mount is the problem. Could anyone help me please?

Upvotes: 0

Views: 378

Answers (1)

bradib0y
bradib0y

Reputation: 1099

The problem is in the "volumes" object inside the YAML config.

Make sure to use indentation to represent the object hierarchy in YAML. This is a very common problem with YAML and most of the time the error messages are missing to address this, or they are not informative.

Previous solution with wrong indentation

volumes:
  hi:
  driver: azure_file
  driver_opts:
    share_name: docker-fileshare
    storage_account_name: cs210033fffa9b41a40

Correct solution

volumes:
  hi:
    driver: azure_file
    driver_opts:
      share_name: docker-fileshare
      storage_account_name: cs210033fffa9b41a40

Upvotes: 2

Related Questions