这是我的docker-compose.yml文件:
这是Dockerfile文件:
当我运行 docker-compose up 命令时,出现以下错误:
问题可能与ssh权限有关,但我将我的ssh密钥作为挂载卷添加到容器中(或者可能是我在那里犯了一些错误):
但它仍然无法正常工作。怎么解决这个问题呢?
这是我的本地机器上~/.ssh目录的权限:
version: '2.1'
services:
users-db:
container_name: users-db
build: git@github.com:lukalopusina/flask-microservices-users.git#master:project/db
volumes:
- '~/.ssh/github:/root/.ssh/id_rsa'
ports:
- 5435:5432 # expose ports - HOST:CONTAINER
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
healthcheck:
test: exit 0
这是Dockerfile文件:
FROM postgres
# Disable checking for known_hosts (maybe not working)
RUN mkdir /root/.ssh && echo "StrictHostKeyChecking no " > /root/.ssh/config
# run create.sql on init
ADD create.sql /docker-entrypoint-initdb.d
当我运行 docker-compose up 命令时,出现以下错误:
Building users-db
ERROR: Error trying to use git: exit status 128 (Cloning into '/var/lib/docker/tmp/docker-build-git576570106'...
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
)
问题可能与ssh权限有关,但我将我的ssh密钥作为挂载卷添加到容器中(或者可能是我在那里犯了一些错误):
volumes:
- '~/.ssh/github:/root/.ssh/id_rsa'
但它仍然无法正常工作。怎么解决这个问题呢?
这是我的本地机器上~/.ssh目录的权限:
drwx------ 2 llopusina llopusina 4096 јун 7 14:22 .ssh
以下是我主机上 ~/.ssh 文件夹下文件的权限:
-rw------- 1 llopusina llopusina 3243 јун 7 14:15 github
-rw-r--r-- 1 llopusina llopusina 749 јун 7 14:15 github.pub
-rw-r--r-- 1 llopusina llopusina 1326 јун 7 14:35 known_hosts