亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法在 docker-compose 中克隆存儲庫

無法在 docker-compose 中克隆存儲庫

Go
ABOUTYOU 2022-08-30 22:03:41
我正在嘗試使用 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。盡管在本地計算機中并非如此,但在容器內就是這種情況。我不知道差異??的原因。usernamepassword

git clone https://github.com/MyGithOrg/TestProject /Users/antarr.byrd/go/src/github.com/MyGithOrg/TestProject

溶液:

您可以使用以下命令通過 SSH 克隆存儲庫:

git clone ssh://[email protected]/MyGithOrg/TestProject.git /Users/antarr.byrd/go/src/github.com/MyGithOrg/TestProject

步驟:

  1. 如上所述,更新克隆命令以使用 SSH。

  2. 如果尚未在 Github 配置文件中配置 SSH 密鑰,則可以按照此文檔進行操作。

    ?? 確保在此步驟中,能夠在本地計算機中使用 SSH 克隆存儲庫。

  3. 更新 docker-compose 文件中以安裝 SSH 客戶端command

    command: >  "
        ls
        apk add --update alpine-sdk openssh
        make Tests
      "
  4. 如果您使用的是 Mac,請確保您的文件中有上述內容。IgnoreUnknown UseKeychainUseKeychain yes~/.ssh/config

    i? 原因是Golang Alpine映像中安裝的版本無法識別選項,并會拋出錯誤。您可以在本文檔中閱讀有關內容的更多信息。opensshUseKeychainBad configuration option: usekeychain

    正確文件的示例:~/.ssh/config

    Host *
      AddKeysToAgent yes
      IgnoreUnknown UseKeychain
      UseKeychain yes
      IdentityFile ~/.ssh/id_rsa
  5. 然后更新您的喜歡以下內容:volumes

    volumes:
      - type: bind
        source: ~/go
        target: /go
      - type: bind
        source: .
        target: /app
      - ~/.ssh:/root/.ssh

    請注意,您不再需要卷。我還刪除了將目錄映射到容器,因為我仍然懷疑它是否可能導致問題。~/.gitconfig:/root/.gitconfigHOME/root

我相信這現在應該對你有用。干杯??!!!


查看完整回答
反對 回復 2022-08-30
  • 1 回答
  • 0 關注
  • 144 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號