我正在尝试使用 docker-compose 将应用配置为在 localstack 上运行。我在尝试克隆存储库时遇到错误。setup-resources_1 | make[1]: [/app/ProjectRecipes.mk:35: clean] Error 2 (ignored)setup-resources_1 | ServiceName=Tests make -C /app/ -f /app/ProjectRecipes.mk deploysetup-resources_1 | git clone https://github.com/MyGithOrg/TestProject /Users/antarr.byrd/go/src/github.com/MyGithOrg/TestProjectsetup-resources_1 | Cloning into '/Users/antarr.byrd/go/src/github.com/MyGithOrg/TestProject'...localstack_1 | Waiting for all LocalStack services to be readysetup-resources_1 | fatal: could not read Username for 'https://github.com': No such device or addresssetup-resources_1 | make[4]: *** [/app/ProjectRecipes.mk:24: /Users/antarr.byrd/go/src/github.com/MyGithOrg/TestProject] Error 128docker-compose.ymlversion: '3'services: localstack: image: localstack/localstack ports: - "53:53" - "443:443" - "4510-4520:4510-4520" - "4566-4620:4566-4620" - "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}" environment: - LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY} - SERVICES=serverless,rds,lambda,sqs,dynamodb,s3,apigateway,stepfunctions,cloudformation,appsync,firehose,es - DEBUG=1 - DATA_DIR=/tmp/localstack/data - DOCKER_HOST=unix:///var/run/docker.sock - HOST_TMP_FOLDER=${TMPDIR} volumes: - "${TMPDIR:-/tmp/localstack}:/tmp/localstack" - "/var/run/docker.sock:/var/run/docker.sock" networks: - default setup-resources: image: golang:1.16.4-alpine3.13 entrypoint: /bin/sh -c working_dir: /app command: > " ls apk add --update alpine-sdk make Tests " networks: - default volumes: - type: bind source: ~/go target: /go - type: bind source: ${HOME} target: /root - type: bind source: . target: /app - ~/.ssh:/root/.ssh - ~/.gitconfig:/root/.gitconfig depends_on: - localstack
1 回答

慕田峪7331174
TA贡献1828条经验 获得超13个赞
问题:
以下命令在容器中失败,因为它是一个交互式命令,需要用户输入 GitHub 和 GitHub。尽管在本地计算机中并非如此,但在容器内就是这种情况。我不知道差异😕的原因。username
password
git clone https://github.com/MyGithOrg/TestProject /Users/antarr.byrd/go/src/github.com/MyGithOrg/TestProject
溶液:
您可以使用以下命令通过 SSH 克隆存储库:
git clone ssh://git@github.com/MyGithOrg/TestProject.git /Users/antarr.byrd/go/src/github.com/MyGithOrg/TestProject
步骤:
如上所述,更新克隆命令以使用 SSH。
如果尚未在 Github 配置文件中配置 SSH 密钥,则可以按照此文档进行操作。
⚠️ 确保在此步骤中,能够在本地计算机中使用 SSH 克隆存储库。
更新 docker-compose 文件中以安装 SSH 客户端
command
command: > " ls apk add --update alpine-sdk openssh make Tests "
如果您使用的是 Mac,请确保您的文件中有上述内容。
IgnoreUnknown UseKeychain
UseKeychain yes
~/.ssh/config
i️ 原因是Golang Alpine映像中安装的版本无法识别选项,并会抛出错误。您可以在本文档中阅读有关此内容的更多信息。
openssh
UseKeychain
Bad configuration option: usekeychain
正确文件的示例:
~/.ssh/config
Host * AddKeysToAgent yes IgnoreUnknown UseKeychain UseKeychain yes IdentityFile ~/.ssh/id_rsa
然后更新您的喜欢以下内容:
volumes
volumes: - type: bind source: ~/go target: /go - type: bind source: . target: /app - ~/.ssh:/root/.ssh
请注意,您不再需要卷。我还删除了将目录映射到容器,因为我仍然怀疑它是否可能导致问题。
~/.gitconfig:/root/.gitconfig
HOME
/root
我相信这现在应该对你有用。干杯🍻!!!
- 1 回答
- 0 关注
- 122 浏览
添加回答
举报
0/150
提交
取消