尝试更改 azure-sql-edge Dockerfile 中的权限
我目前正在基于“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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,映像 azure-sql-edge 不以 root 身份运行。
由于这是为了开发,以 root 身份运行来修复权限问题是可以的。在“FROM”修复问题后,在 Dockerfile 中添加了以下命令
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