Running docker-compose inside Google Cloud Engine

I'm trying to run a small docker creation application in a container-optimized Google Cloud Compute Engine node, but I get stuck when it tries to set volumes during docker-compose up:

Creating lightning_redis_1 ... 
Creating lightning_db_1 ... 
Creating lightning_redis_1
Creating lightning_db_1 ... done
Creating lightning_api_1 ... 
Creating lightning_api_1 ... error
ERROR: for lightning_api_1  Cannot start service api: error while creating mount source path '/rootfs/home/jeremy/lightning': mkdir /rootfs: read-only file sys
tem
ERROR: for api  Cannot start service api: error while creating mount source path '/rootfs/home/jeremy/lightning': mkdir /rootfs: read-only file system
Encountered errors while bringing up the project.
jeremy@instance-1 ~/lightning $ 

My docker-compose.yml file looks like this:

version: '3'
services:
  client:
    build: ./client
    volumes:
      - ./client:/usr/src/app
    ports:
      - "4200:4200"
      - "9876:9876"
    links:
      - api
    command: bash -c "yarn --pure-lockfile && yarn start"
  sidekiq:
    build: .
    command: bundle exec sidekiq
    volumes:
      - .:/api
    depends_on:
      - db
      - redis
      - api
  redis:
    image: redis
    ports:
      - "6379:6379"
  db:
    image: postgres
    ports:
      - "5433:5432"
  api:
    build: .
    command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
    volumes:
      - .:/myapp
    ports:
      - "3000:3000"
    depends_on:
      - db

I do not want to change anything in the docker-compose.yml file. I would prefer to fix this problem by executing the commands inside the virtual machine itself or how I installed the VM. The reason is that this is not my code, and I cannot easily modify the docker-compose.yml file, and all I need to do is run it for a short period of time and execute several commands that create dockers inside the virtual machine.

+4
1

.

source path '/rootfs/home/jeremy/lightning': mkdir /rootfs: read-only file sys

,

docker-compose

,

volumes:
  - myappvol:/myapp

volumes:
  myappvol: {}

, yaml,

docker-compose

docker-compose , docker-compose ,

docker run \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v "$PWD:/rootfs/$PWD" \
    -w="/rootfs/$PWD" \
    docker/compose:1.13.0 up

, .

.

https://cloud.google.com/community/tutorials/docker-compose-on-container-optimized-os

+3

Source: https://habr.com/ru/post/1685520/


All Articles