尝试更改 azure-sql-edge Dockerfile 中的权限

发布于 2025-01-11 02:05:33 字数 2045 浏览 0 评论 0原文

我目前正在基于“mcr.microsoft.com/azure-sql-edge:latest”设置一个 docker 映像,

下面是我的 docker 文件的一部分

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"]

当我运行“docker build -t sql-edge”时。我得到以下输出/ 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

似乎不允许更改加载到 img 中的脚本的权限,

对于 docker,我是一个菜鸟。

PS:startup.sh 脚本是。包含我所有表的脚本并查看定义。我的任务是将现有的 mssql docker 映像升级为 azure-sql-edge 映像。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦一生花开无言 2025-01-18 02:05:33

默认情况下,映像 azure-sql-edge 不以 root 身份运行。
由于这是为了开发,以 root 身份运行来修复权限问题是可以的。在“FROM”修复问题后,在 Dockerfile 中添加了以下命令

USER root

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文