question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docker image built with`-bt prodction` throws permission denied on `/usr/local/bin/dockerd-entrypoint.sh`

See original GitHub issue

🐛 Describe the bug

After building the docker image with production built type as follows:

$ ./build_image.sh -bt production --gpu --tag torchserve:cuda113 -cv cu11

The container runs into the following error at startup:

$ docker run -it -p8080:8080 -p8081:8081 -p8082:8082 \
     -v $(pwd)/model_store:/home/model-server/model-store \
     torchserve:cuda113 \
     torchserve --model-store model-store --models mymodel=mymodel.mar

/bin/bash: /usr/local/bin/dockerd-entrypoint.sh: Permission denied

Note that it works fine with --bt dev

Error logs

$ docker run -it -p8080:8080 -p8081:8081 -p8082:8082 \
     -v $(pwd)/model_store:/home/model-server/model-store \
     torchserve:cuda113 \
     torchserve --model-store model-store --models mymodel=mymodel.mar

/bin/bash: /usr/local/bin/dockerd-entrypoint.sh: Permission denied

Installation instructions

$ git clone git@github.com:pytorch/serve.git

Model Packaing

torch-model-archiver --model-name mymodel \
    --version 1.0 \
    --serialized-file "model_scripted.pt" \
    --handler image_segmenter \
    --export-path model_store -f

or equivalent but not relevant as it works in 3 different contexts

config.properties

No response

Versions

master at commit 695b90e5acc8b1afc08cb0f73f8f58b8915b9b52

Repro instructions

$ cd serve/docker
$ ./build_image.sh -bt production --gpu --tag torchserve:cuda113 -cv cu11
$ docker run -it -p8080:8080 -p8081:8081 -p8082:8082 \
     -v /home/ubuntu/model_store:/home/model-server/model-store \
     torchserve:cuda113 \
     torchserve --model-store model-store --models mymodel=mymodel.mar

Possible Solution

Just don’t set the entrypoint maybe as it’s not in the Dockerfile.dev

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Chichilelecommented, Oct 12, 2022

up? I’ve been building my tochserve images this way for about a month now and it works just fine. Otherwise probably best to close this issue.

1reaction
Chichilelecommented, Sep 3, 2022

The COPY works fine, it it looks like it’s more to do with how the permissions are set. I managed to get it to work. I bumped into another permission error with the config file. Just add a read permission to the entrypoint and change the ownership of the config file as follows:

COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh

RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh \
    && chown -R model-server /home/model-server

COPY config.properties /home/model-server/config.properties
RUN mkdir /home/model-server/model-store && chown -R model-server /home/model-server/model-store

to

COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh

COPY config.properties /home/model-server/config.properties

RUN mkdir /home/model-server/model-store \
    && chmod +rx /usr/local/bin/dockerd-entrypoint.sh \
    && chown -R model-server /home/model-server

Should I open a PR wit this? I didn’t run all the tests you ask for but I managed to serve a model and run an inference

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Docker Permission Denied? - phoenixNAP
Using the docker images command without sudo to check if the Permission Denied command persists. Method 2: Run Docker Commands with sudo.
Read more >
Troubleshooting Docker Permission Denied Problems
Launch your terminal and prepend sudo to the docker command below to run the hello-world Docker image. Since you're running an elevated command, ......
Read more >
Container permission denied: How to diagnose this error
Learn what is causing a container permissions error and how to work around the issue without resorting to the --privileged flag.
Read more >
How to fix docker: Got permission denied issue - Stack Overflow
If you want to run docker as non-root user then you need to add it to the docker group. Create the docker group...
Read more >
Avoiding Permission Issues With Docker-Created Files
The user of the container (root in the worst case) is completely different than the one on the host. The file permissions and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found