gpt4 book ai didi

macos - docker-compose up 对 sh 文件的权限被拒绝

转载 作者:行者123 更新时间:2023-12-02 21:02:34 27 4
gpt4 key购买 nike

我有以下 docker-compose.yml 文件:

version: "3" services:\   local_db:
build:
context: mssql-data
dockerfile: Dockerfile
ports:
- "1433:1433"
volumes:
- ~/Documents/rfg/temp
environment:
SA_PASSWORD: "D0ckerDev"
ACCEPT_EULA: "Y"

当我运行 docker-compose up 时,出现以下错误:

local_db_1  | /scripts/entrypoint.sh: line 5: /scripts/seed-data.sh: Permission denied
docker_local_db_1 exited with code 126

入口点在哪里:

#start SQL Server in the background
/opt/mssql/bin/sqlservr &

# start the seed data script
/scripts/seed-data.sh

seed-data.sh 在哪里:

sleep 15s cd /scripts

if [ -f /var/opt/mssql/data/initialized ]; then
sleep infinity
fi sleep 15s /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $SA_PASSWORD -d master -i setup.sql

touch /var/opt/mssql/data/initialized sleep infinity

和入口点.sh:

#start SQL Server in the background
/opt/mssql/bin/sqlservr &

# start the seed data script
/scripts/seed-data.sh

和 Dockerfile:

FROM microsoft/mssql-server-linux:2017-latest

COPY . /scripts

CMD chmod 755 /scripts/*
CMD chmod 755 /scripts/seed-data.sh

CMD /bin/bash /scripts/entrypoint.sh

以上在 Windows 中工作正常,但在 MacOS 上我得到上面的 epermission denied 错误..

最佳答案

您似乎没有为您的 seed-data.sh 脚本设置正确的权限。你可以这样调用它:

sh /scripts/seed-data.sh

或者您可以首先确保所有脚本都是可执行的:

chmod 755 /scripts/*
/scripts/seed-data.sh

关于macos - docker-compose up 对 sh 文件的权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59844104/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com