I am working with the config.yml below and can’t seem to access a proxy server on the docker container started via setup_remote_docker by accessing its proxy from the docker container spec’d in (build: docker: image:) in my config.yml. Is this possible? I’ve started the second container running the proxy with -p 8080:8080 which failed. I additionally tried starting it with --network=“host” which also failed.
Curl returns “Failed to connect to IP address at port 8080: Connection timed out. Exited with code 1”
Appreciate any insight as to why networking appears to be failing between these two containers and what my options are.
version: 2
general:
branches:
only:
- never-build
jobs:
build:
docker:
- image: circleci/node:8.11
steps:
- checkout
- run:
name: Install Project
command: |
cd project
npm install
- setup_remote_docker
- run:
name: Run Proxy
command: |
docker pull owasp/zap2docker-stable
docker run --name zap -u zap -p 8080:8080 --network="host" -i owasp/zap2docker-stable zap.sh -daemon -host 0.0.0.0 -port 8080 -config api.disablekey=true -config api.addrs.addr.name=.* -config api.addrs.addr.regex=true
background: true
- run:
name: Wait For Proxy
command: |
CONTAINER_STATUS="unhealthy"
until [ $CONTAINER_STATUS == "healthy" ]
do
sleep 10
{
CONTAINER_STATUS=$(docker inspect --format='{{.State.Health.Status}}' zap)
} || {
CONTAINER_STATUS="unhealthy"
}
done
CONTAINER_HOST_IP=$(echo $DOCKER_HOST | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
curl http://$CONTAINER_HOST_IP:8080/JSON/core/view/version/?zapapiformat=JSON | grep ‘version’
workflows:
version: 2
scheduled-workflow:
triggers:
- schedule:
cron: "0 4 * * *"
filters:
branches:
only: master
jobs:
- build
).