1

I'm currently setting up a docker image based on "mcr.microsoft.com/azure-sql-edge:latest"

Below is part of my docker file

FROM mcr.microsoft.com/azure-sql-edge:latest

COPY startup.sh /startup.sh

RUN chmod u+x /startup.sh

...

CMD ["/bin/bash", "-c", "/startup.sh"]

When I run "docker build -t sql-edge . I get the following output / error

% docker build -t sql-edge .
[+] Building 3.0s (7/7) FINISHED                                                                           
 => [internal] load build definition from Dockerfile                                                  0.5s
 => => transferring dockerfile: 37B                                                                   0.0s
 => [internal] load .dockerignore                                                                     0.7s
 => => transferring context: 2B                                                                       0.0s
 => [internal] load metadata for mcr.microsoft.com/azure-sql-edge:latest                              0.0s
 => [internal] load build context                                                                     0.4s
 => => transferring context: 32B                                                                      0.0s
 => [1/3] FROM mcr.microsoft.com/azure-sql-edge:latest                                                0.0s
 => CACHED [2/3] COPY startup.sh /startup.sh                                                          0.0s
 => ERROR [3/3] RUN chmod u+x /startup.sh                                                             1.5s
------                                                                                                     
 > [3/3] RUN chmod u+x /startup.sh:
#7 0.937 chmod: changing permissions of '/startup.sh': Operation not permitted
------
executor failed running [/bin/sh -c chmod u+x /startup.sh]: exit code: 1

Seems like changing the permission of a script, loaded into the img isn't permitted.

I am a noob when it comes to docker. Anyone able to point me in the right direction here?

PS: The startup.sh script, is a script containing all my table and view definitions. My task is to upgrade an already existing mssql docker image to be a azure-sql-edge image.

hogni89
  • 1,920
  • 6
  • 22
  • 39

1 Answers1

1

The image azure-sql-edge doesn't run as root per default. Since this is for development, running as root to fix permission issues is ok. Added the following command to the Dockerfile after "FROM" fixed the issue

USER root
hogni89
  • 1,920
  • 6
  • 22
  • 39