2

On my host machine, I'm able to create a second user: admin and push to that user's git folder using:

admin@localhost:folder

When I create a Docker container hosting a git server, after exposing port 22 how do I git push from my local machine to localhost:22 which would be the location of the container's ports?

1
  • Possibly duplicate of This
    – ntshetty
    Commented Apr 12, 2018 at 2:57

1 Answer 1

3

Probably you are trying to bind docker container port 22 to already occupied port 22 of your host. You need to map container ssh server to other not occupied port of your host e.g. 5000.

You can expose particular ports during container start-up with flag "-p HOST_PORT:CONTAINER_PORT":

docker run -p 127.0.0.1:5000:22 docker_image

Then you should be able to reach container's GIT server:

git add container [email protected]:5000/folder
git push container branch_name
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.