Closed dwenzel closed 7 years ago
I think it should work, but, from jenkins, you are connecting to the wrong container.
try ssh -p 2222 sshdev
Thank you very much!
Additionally I had to link my sshdev container to the ci container
#######################################
# Jenkins CI Docker container
#######################################
ci:
build: docker/jenkins
links:
- dev
- sshdev
volumes:
- ./docker/jenkins/JENKINS_HOME/:/usr/share/jenkins/ref/
- ./docker/jenkins/plugins/:/usr/share/jenkins/ref/plugins/
- ./:/docker/
ports:
- "8080:8080"
- "9418:9418"
cap_add:
- SYS_PTRACE
privileged: true
env_file:
- etc/environment.yml
- etc/environment.development.yml
######################################
# ssh service for dev container
######################################
sshdev:
image: jeroenpeeters/docker-ssh
environment:
#todo: replace jenkinsdocker with variable
- CONTAINER=jenkinsdocker_dev_1
- AUTH_MECHANISM=noAuth
ports:
- "2222:22"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /Applications/Docker.app/Contents/Resources/bin/docker:/usr/bin/docker
#######################################
# dev - mock dev server
#######################################
dev:
build: docker/web
volumes:
- ./app/dev/:/app/
- ./:/docker/
ports:
- "8081:80"
Than I could ssh from ci to dev (using the default! port):
jenkins@26b7c4a623a3:/tmp/files$ ssh sshdev
The authenticity of host 'sshdev (172.17.0.2)' can't be established.
RSA key fingerprint is 36:e1:fc:d8:be:10:8a:26:d9:d1:e6:1f:aa:78:cf:93.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'sshdev,172.17.0.2' (RSA) to the list of known hosts.
###############################################################
## Docker SSH ~ Because every container should be accessible ##
###############################################################
## container | jenkinsdocker_dev_1 ##
###############################################################
/app $
ah yes, indeed. Between linked containers ports aren't mapped. Ports are only mapped between containers and the host.
I'm trying to ssh from one container into another using docker-ssh.
Currently only ssh-ing from host to container works:
From within the jenkins container connection is refused:
The containers are set up using docker-compose:
Do I miss something or is it impossible?