I’m having trouble figuring out how to connect to an SFTP server I want to run as part of my docker setup. Here is the configuration that I"m using to launch the SFTP container:
- run:
name: Run Docker FTP test server
command: |
docker run --restart=always \
-p 2222:22 \
--name sftp_test_server \
-d atmoz/sftp foo:pass:::from_no
I’m having trouble connecting to it from my main app. How do I find the hostname for this container and make sure it’s in the same network? When my test suite runs my app can’t find this service.
If you run this image inside the image section of your YAML config file, it may be easier - CircleCI exposes secondary container listeners on localhost.
Alternatively you could put your FTP server and your main app in separate containers and run them both using Docker Compose. That’s what I do, and it works fine.
Your approach of using docker run should work, but you’d need to find what IP it attaches to - perhaps you could SSH in and use nstat?