0

I am trying to set up a Satis installation with the official Docker image composer/satis. The private repository I have put uses an SSH key with a passphrase. I use a syntax in the SSH config that allows me to use one key by repository. When I launch docker-compose up with this file :

version: "3.2"
services:
  satis:
    image: composer/satis
    container_name: satis
    hostname: satis
    volumes:
      - /var/www/html/satis:/build
      - /usr/local/bin/composer:/composer/composer
      - ~/.ssh/id_my_repo:/root/.ssh/id_my_repo
      - ~/.ssh/known_hosts:/root/.ssh/known_hosts
      - ~/.ssh/satisConfig.txt:/root/.ssh/config
      #- /~/.ssh/known_hosts:/etc/ssh/ssh_known_hosts

    environment:
      SATIS_CONFIG_FILE: /build/satis.json
      COMPOSER_NO_INTERACTION: 1
      PRIVATE_REPO_DOMAIN_LIST: bitbucket.org gitlab.com github.com
      GIT_SSH_COMMAND: "ssh -v"
    ports:
      - 8181:80

(Obviously, I replace my real repository name). and the satis.json file :

{
  "name": "myuser/my-satis",
  "homepage": "http://my.satis.url",
  "repositories": [
    {
      "type": "vcs",
      "url": "git@github.com-my-repo:myuser/my-repo.git",
      "name:": "myuser/my-repo",
      "options": {
        "ssh2": {
          "username": "myuser",
          "password": "mypassword",
          "pubkey_file": "/home/myuser/.ssh/id_my-repo.pub",
          "privkey_file": "/home/myuser/.ssh/id_my-repo"
        }
      }
    }
  ]
}

and my SSH config :

Host github.com-my-repo
  Hostname github.com
  IdentityFile=/root/.ssh/id_my_repo

Host *
  UserKnownHostsFile /root/.ssh/known_hosts
  GlobalKnownHostsFile /root/.ssh/known_hosts
  IdentitiesOnly yes
  ServerAliveInterval 30
  ServerAliveCountMax 6

the git command git clone --mirror -- 'git@github.com-mon-repo:myuser/mon-repo.git' '/composer/cache/vcs/git-github.com-mon-repo-myuser-mon-repo.git/' fails with the message :

ssh: Could not resolve hostname github.com-my-repo: Name does not resolve

If I launch this command at the outside of the container, it works...so what can be wrong? Docker version 20.10.17, build 100c701. docker-compose version 1.29.2, build 5becea4c

EDIT

I have some slashes before my ~ in front of some of my paths. I fixed that. Now I have :

debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: No more authentication methods to try.
git@github.com: Permission denied (publickey).

lionelp
  • 443
  • 1
  • 7
  • 21
  • This isn't really Git or ssh, it's just a Docker issue with respect to how you've set up your network access within the docker image. You have set things up so that your `git clone` operation happens inside the virtual machine created by running Docker. That VM therefore needs to be able to resolve names to IP addresses and reach the outside world. But something is wrong in the VM's setup such that it *can't* do the name-resolving step. There could be many smaller sub-problems, each of which will have its own separate solution. – torek Nov 25 '22 at 00:48
  • *Instead of* tracking down and solving these, however, you might wish to do your `git clone` step *before* setting up the docker virtual machine, so that you do not have to reach out to github at all from within the docker VM. – torek Nov 25 '22 at 00:49
  • It's an official Docker image, it's not me that launches the `git` command so if I use put a git command at the outside, there will still be a `git` command inside that will crash the process. Apparently, you do not have tried to use it. – lionelp Nov 25 '22 at 08:37
  • Indeed, I have not - but you'll find the above to be true, there's something wrong with the docker setup. You can debug that if you prefer. – torek Nov 25 '22 at 09:25
  • can the docker container access other external sites or is it just that particular one that is not working inside the container? – Paul Collingwood Nov 25 '22 at 14:13
  • If I replace my private repository by a public one in `satis.json`, the git command works. – lionelp Nov 25 '22 at 14:28

0 Answers0