How to run docker in docker in Container-optimized OS on Compute Engine VM on Google Cloud?

Faisal Alam

I have a master container instance (Node.js) that runs some tasks in a temporary worker docker container.

The base image used is node:8-alpine and the entrypoint command executes with user node (non-root user).

I tried running my container with the following command:

docker run \
-v /tmp/box:/tmp/box \
-v /var/run/docker.sock:/var/run/docker.sock \
ifaisalalam/ide-taskmaster

But when the nodejs app tries running a docker container, permission denied error is thrown - the app can't read /var/run/docker.sock file.

Accessing this container through sh and running ls -lha /var/run/docker.sh, I see that the file is owned by root:412. That's why my node user can't run docker container.

The /var/run/docker.sh file on host machine is owned by root:docker, so I guess the 412 inside the container is the docker group ID of the host machine.


I'd be glad if someone could provide me an workaround to run docker from docker container in Container-optimized OS on GCE.


The source Git repository link of the image I'm trying to run is - https://github.com/ifaisalalam/ide-taskmaster

Faisal Alam

Adding the following command into my start-up script of the host machine solves the problem:

sudo chmod 666 /var/run/docker.sock

I am just not sure if this would be a secure workaround for an app running in production.

EDIT:

This answer suggests another approach that might also work - https://stackoverflow.com/a/47272481/11826776

Also, you may read this article - https://denibertovic.com/posts/handling-permissions-with-docker-volumes/

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to schedule a docker run on google cloud

分類Dev

Google Compute Engine VM constantly crashes

分類Dev

Google Cloud Compute Engine VMが不明な理由で停止しましたか?

分類Dev

How to run a cron job inside a docker container?

分類Dev

Cannot bind ports to my container in Google Container optimized VM

分類Dev

Google Compute Engine Container Port Closed

分類Dev

How to authenticate Docker container with Google Service

分類Dev

Goを使用したGoogle Container / Compute EngineのGoogle Cloudへのロギング

分類Dev

Run interactively with existing docker container

分類Dev

Run protoc command into docker container

分類Dev

Google Cloud Container Optimized OS(COS)にgcsfuseをインストールする

分類Dev

Google Cloud Run Container Networking

分類Dev

Allow external user to start/stop Google Compute Engine VM instance

分類Dev

VSCode: How to run a Jupyter notebook in a docker container, over a remote server?

分類Dev

how to share folder between host os and docker container

分類Dev

how to ssh docker container

分類Dev

how to ssh docker container

分類Dev

how to ssh docker container

分類Dev

How to push existing docker image to google app-engine

分類Dev

Google Cloud Storage、Compute Engine、InsufficientPermissionエラー

分類Dev

How Does Container Optimized OS Handle Security Updates?

分類Dev

Spring Cloud Config in Docker container is not accessible

分類Dev

Cloud sql proxy not working from docker container

分類Dev

How to add a docker container to an existing docker network

分類Dev

strptime throws error when run in docker container

分類Dev

Docker container will automatically stop after "docker run -d"

分類Dev

Started container with docker run, now it is not showing up in docker ps -a

分類Dev

Dockerの違いdockerrun [...] docker container run [...]

分類Dev

Google Compute Engine GPU

Related 関連記事

  1. 1

    How to schedule a docker run on google cloud

  2. 2

    Google Compute Engine VM constantly crashes

  3. 3

    Google Cloud Compute Engine VMが不明な理由で停止しましたか?

  4. 4

    How to run a cron job inside a docker container?

  5. 5

    Cannot bind ports to my container in Google Container optimized VM

  6. 6

    Google Compute Engine Container Port Closed

  7. 7

    How to authenticate Docker container with Google Service

  8. 8

    Goを使用したGoogle Container / Compute EngineのGoogle Cloudへのロギング

  9. 9

    Run interactively with existing docker container

  10. 10

    Run protoc command into docker container

  11. 11

    Google Cloud Container Optimized OS(COS)にgcsfuseをインストールする

  12. 12

    Google Cloud Run Container Networking

  13. 13

    Allow external user to start/stop Google Compute Engine VM instance

  14. 14

    VSCode: How to run a Jupyter notebook in a docker container, over a remote server?

  15. 15

    how to share folder between host os and docker container

  16. 16

    how to ssh docker container

  17. 17

    how to ssh docker container

  18. 18

    how to ssh docker container

  19. 19

    How to push existing docker image to google app-engine

  20. 20

    Google Cloud Storage、Compute Engine、InsufficientPermissionエラー

  21. 21

    How Does Container Optimized OS Handle Security Updates?

  22. 22

    Spring Cloud Config in Docker container is not accessible

  23. 23

    Cloud sql proxy not working from docker container

  24. 24

    How to add a docker container to an existing docker network

  25. 25

    strptime throws error when run in docker container

  26. 26

    Docker container will automatically stop after "docker run -d"

  27. 27

    Started container with docker run, now it is not showing up in docker ps -a

  28. 28

    Dockerの違いdockerrun [...] docker container run [...]

  29. 29

    Google Compute Engine GPU

ホットタグ

アーカイブ