I have a custom Python docker image containing a flask app, that has port 5000 exposed and works locally. If I run “docker run -d -p 8080:5000 testing”, a json with “hello world” appears at localhost:8080. nosetests pass when I run in CircleCI as a workflow.
I followed the instructions for deploying to Fargate ecs-ecr, changing the Dockerfile and .circleci/config.yml to match my application. Everything runs except the “Test image” step… The result of that is always “curl: (7) Failed to connect to localhost port 8080: Connection refused”. (All of these curl commands succeed locally.) If I comment out that test, the config.yml proceeds to the end, but my ECS services all have an “unhealthy” healthcheck status. I’m guessing this is related to the reason this image test is also failing… any suggestions of other things to try here? Thanks!
My code snippet is below for the Test Image step, with various things I tried.
- run:
name: Test image
command: |
docker run -d -p 8080:5000 --name built-image $FULL_IMAGE_NAME
sleep 10
docker run --network container:built-image appropriate/curl --retry 10 --retry-connrefused http://localhost:8080 | grep “hello”
#docker exec curl http : / / localhost:8080 | grep “hello”
#curl http : / / localhost:8080 | grep “hello”
Dockerfile:
FROM
COPY . /app
EXPOSE 5000
WORKDIR /app
RUN pip install -r requirements.txt
ENV PYTHONPATH “{RBASE}:{PYTHONPATH}”
ENTRYPOINT [“python”]
CMD [“app.py”]