[DOCKER] Ssh connect from container to git with VSCode Remote Container

I made it possible to edit the docker container locally using VScode Remote Container, but I stumbled a little when connecting to git, so I made a note.

How to make a git connection using a local ssh key

Add the following to .devcontainer/docker-compose.yml


      - .:/workspace:cached
      - ~/.ssh:/root/.ssh #ssh key
      - ~/.gitconfig:/root/.gitconfig #git settings

Now you can use your local ssh key inside the container as well.

Recommended Posts

Ssh connect from container to git with VSCode Remote Container
Setting to exit from Docker container with VScode
I wanted to develop PHP with vscode remote container
Connect to Amazon EC2 with SSH (Ubuntu)
Connect from local to remote host JMX via SSH port forwarding
How to develop from VScode in a remote destination environment or a remote destination container environment
Connect from Java to PostgreSQL
Connect to MySQL 8 with Java
Connect to oracle with eclipse!
[Docker context] ~ How to access docker in remote environment from VScode ~
How to develop in a container with --privileged and / sbin / init passed in VSCode Remote Containers
Ruby on Rails development environment construction with Docker + VSCode (Remote Container)
Let's create a Docker container that can connect to CentOS 8 with the minimum configuration by SSH
Connect to Rails server with iPhone
From "Create mvn project" to "Create remote repository in GitLab" to "git init"
Update MySQL from 5.7 to 8.0 with Docker
How to SSH into Ubuntu from a terminal with public key authentication
How to compile Java with VsCode & Ant
Connect from Java to MySQL using Eclipse
Introduced vscode with apt to docker: ubuntu
[Docker] Copy files from docker container to host
Remote Container access to localhost returns ERR_EMPTY_RESPONSE
Connect with VS Code from a Windows client to Docker on another server
I was addicted to not being able to connect to AWS-S3 from the Docker container
Sample to create PDF from Excel with Ruby
Edit Docker Container in VSCode multi-stage SSH Vagrant
I want to play with Firestore from Rails
Ssh connect using SSHJ from a Java 6 app
Create a private key / public key in CentOS8.2 and connect to SSH with VS Code