CircleCI 2.0 Host - Connection refused

docker
circle.yml
cci-20

#1

Like severals previous topic, I have a problem during my builds on CircleCi version 2.0

I’m using the docker executorType with the setup remote docker option.

I’m using also an ubuntu:16.04 image that I customize after with some depedencies (curl, git, php, etc…)

The /etc/hosts file is edited with a new line as :

127.0.0.1 local-xxxxxx.xxx.com

So, during the CircleCI builds, my Docker containers are built and up via docker-compose and there is no problems here.

One of these containers that I will named mainContainer is exposed with ports 80.

Now, I want to test my URL address that I specified inside my /etc/hosts via a CURL command as :

curl -v http://local-xxxxxx.xxx.com:80

And this is the results of the command :

* Rebuilt URL to: http://local-xxxxxx.xxx.com/
*   Trying 127.0.0.1...
* connect to 127.0.0.1 port 80 failed: Connection refused
* Failed to connect to local-xxxxxx.xxx.com port 80: Connection refused
* Closing connection 0
curl: (7) Failed to connect to local-xxxxxx.xxx.com port 80: Connection refused

What’s wrong ? This configuration works on local. Here is my circle.yml :

version: 2
jobs:
build:
docker:
- image: ubuntu:16.04
environment:
TZ: "/usr/share/zoneinfo/Europe/paris"
steps:
- setup_remote_docker
- run:
name: Install dependencies
command: |
uname -a
apt-get update && apt-get install -y curl wget bzip2 npm python-pip php php7.0-xml sshpass vim libfontconfig git
- checkout
- run:
name: Install Docker client
command: |
set -x
VER="17.03.0-ce"
curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
- run:
name: Install Docker Compose
command: pip install docker-compose
- run:
name: Add vhost
command: echo 127.0.0.1 local-xxxxxx.xxx.com | tee -a /etc/hosts
- run:
name: Build application Docker image PHP 5.6
command: |
docker-compose -f docker-compose.yml -f docker-compose.stage.yml build
- run:
name: Up PHP 5.6 container
command: |
docker-compose -f docker-compose.yml -f docker-compose.stage.yml up -d
sleep 60
- run:
name: Test Page URL
command: |
curl --retry 30 --retry-delay 3 -v http://local-xxxxxx.xxx.com:80

Thank you to help me :sob:


#2

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.