Running docker-compose inside a Google Cloud Engine -


i'm trying run small docker-compose app inside container-optimized google cloud compute engine node, i'm getting stuck when it's trying mount 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: 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: 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 project. jeremy@instance-1 ~/lightning $  

my docker-compose.yml file looks 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 don't want have change in docker-compose.yml file - i'd prefer able fix issue running commands inside vm itself, or in how set vm up. reason being it's not code , can't change docker-compose.yml file easily, , need run short period of time , execute few docker-compose commands inside vm.

container optimized os mounts of paths read-only. why getting error

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

so have few options

use named volumes in docker-compose

you need change volumes below

volumes:   - myappvol:/myapp 

and define top level volumes in compose

volumes:   myappvol: {} 

as said don't want modify yaml may not work you

run docker-compose inside docker

currently run docker-compose on main machine, instead should use docker-compose inside docker container has main root folder

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

this work data persisted inside docker container itself.

see below article more details

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


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -