Container port not available

python

#1

Circle 2.0 looks really good. I’m struggling to get a port open from Nextcloud to the system under test. This is the image configuration from circle.yml:

containerInfo:
    - image: ubuntu:16.04
      cmd: ["/bin/bash"]
    - image: python:2.7
    - image: mysql:8.0
      env:
          - MYSQL_ROOT_PASSWORD=root
          - MYSQL_DATABASE=circle_test
          - MYSQL_USER=ubuntu
          - MYSQL_PASSWORD=ubuntu
    - image: couchbase/sync-gateway:1.3.1-community
    - image: wonderfall/nextcloud:11.0
      env:
          - ADMIN_USER=admin
          - ADMIN_PASSWORD=admin
      ports:
          - 8888:8888

However, by the time the tests that depend on Nextcloud are reached, the connection on port 8888 is refused:

ConnectionError: HTTPConnectionPool(host='localhost', port=8888): Max retries exceeded with url: ocs/v1.php/cloud/capabilities (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7fb08f279250>: Failed to establish a new connection: [Errno 111] Connection refused',))

When I had this issue working locally I added the -p 8888:8888 to the docker run command, so I’m wondering what the equivalent of this is in CircleCI 2?

The 8888 port is already exposed by the Nextcloud image https://hub.docker.com/r/wonderfall/nextcloud/~/dockerfile/


#2

Also does not work with publish: instead of ports:


#3

We automatically expose the port, but the container may not be running like you expect. Can you try running a build with it as your base image and running the “run.sh” script in it? There may be an error in the environment.

With that said, we are working to expose STDOUT and STDERR for these containers.


#4

Thanks for the suggestion.

First I tried just requesting the run.sh script by adding it in cmd:, but that did not help.

So I’ve gone with your suggestion of using the Nextcloud image as the base image - this is my config:

containerInfo:
    - image: wonderfall/nextcloud:11.0
      cmd: ["run.sh"]
      env:
          - ADMIN_USER=admin
          - ADMIN_PASSWORD=admin
    - image: ubuntu:16.04
      cmd: ["/bin/bash"]
    - image: python:2.7
    - image: mysql:8.0
      env:
          - MYSQL_ROOT_PASSWORD=root
          - MYSQL_DATABASE=circle_test
          - MYSQL_USER=ubuntu
          - MYSQL_PASSWORD=ubuntu
    - image: couchbase/sync-gateway:1.3.1-community

The issue is that with or without the ubuntu image, I can not get the build to run because it requires bash and the error is:

apt-get update &&
apt-get install -y git python-pip libmysqlclient-dev
fork/exec /bin/bash: no such file or directory

Do you have any suggestions how I can make bash available while using that Nextcloud image as base? The test run also needs apt and git.

This is the docker command that works locally for me:

docker run -d --name nextcloud -e ADMIN_USER=admin -e ADMIN_PASSWORD=admin -p 8888:8888 wonderfall/nextcloud:11.0

#5

Nginx is having problems. https://circleci.com/gh/ryanwohara/test-2.0/184

nginx: [alert] could not open error log file: open() “/var/lib/nginx/logs/error.log” failed (13: Permission denied)
2017/03/01 16:55:02 [emerg] 115#115: open() “/var/lib/nginx/logs/error.log” failed (13: Permission denied)

This does not happen locally, and I do not yet know why we’re seeing this.


#6

Thanks Ryan - that’s really helpful. I’m glad you shared your test build because that’s given me some good ideas for how to test containers on Circle 2.

I’ve done some Googling for the issue and it looks like it’s already been recorded with the wonderfall/nextcloud image here: https://github.com/Wonderfall/dockerfiles/issues/37 . There seem to be some requirements about the host system having a “newish” filesystem.

What system is Circle 2 hosted on?


#7

We’re using AUFS on 2.0


#8

OK thanks for confirming. What version of aufs is in use please?

As mentioned in the Nginx error thread (https://github.com/Wonderfall/dockerfiles/issues/37#issuecomment-249576104) there have been some errors reported with permissions and aufs in Docker such as https://github.com/docker/docker/issues/20240


#9

The Ubuntu/Linux kernel locks the AUFS version; the kernel version is 3.13.0-107-generic.


#10