how jenkins in a docker access git-repo of gitlab in another docker -
i installed both gitlab-docker , jenkins-docker on same server(my laptop):
docker run --name gitlab-postgresql -d \ --env 'db_name=gitlabhq_production' \ --env 'db_user=gitlab' --env 'db_pass=password' \ --volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \ quay.io/sameersbn/postgresql:9.4-5 docker run --name gitlab-redis -d \ --volume /srv/docker/gitlab/redis:/var/lib/redis \ quay.io/sameersbn/redis:latest docker run --name gitlab -d \ --link gitlab-postgresql:postgresql --link gitlab-redis:redisio \ --publish 10022:22 --publish 80:80 \ --env 'gitlab_port=10080' --env 'gitlab_ssh_port=10022' \ --env 'gitlab_secrets_db_key_base=long-and-random-alpha-numeric-string' \ --volume /srv/docker/gitlab/gitlab:/home/git/data \ quay.io/sameersbn/gitlab:8.0.5-1 docker run --name myjenkins -p 8080:8080 -v /var/jenkins_home jenkins
in myjenkins docker ,use bash run
git ls-remote -h ssh://git@localhost:10022/rhtj/yirongtong.git head
or
git ls-remote -h ssh://git@10.0.0.131:10022/rhtj/yirongtong.git head
which said:
ssh:connect host localhost port 10022: connection refused fatal: not read remote repository.
and have added ssh pub-key gitlab,that can't work. help!!
when 1 container (using default network bridge driver) needs contact another, not need use mapped (to host) port.
it use directly port exposed other container (here port 22).
if jenkins container can run --link
gitlab container, avoid having use localhost or docker-machine ip , mapped port: using directly gitlab-server:22
.
Comments
Post a Comment