Error linking Python as Codeship service in Docker




I’m getting my feet wet with Codeship Pro + Docker, and am currently trying to set up an environment that looks like this:

  • NodeJS 8.2.1
  • Python 2
  • Chrome (Headless)

Codeship is currently throwing the error:

Build Error: API error (500): {"message":"Cannot link to a non running container: /jet-python-build AS /jet-web-build/python"}

The Dockerfile is based on node:8.2.1 (which I confirmed to be working because it npm install'ed everything prior to adding python to my codeship-services.yml file), and the codeship-services.yml looks like this:

    image: app-container
    dockerfile: Dockerfile
    - python
    - chrome-headless
  image: python:2
  image: justinribeiro/chrome-headless

I also tried it with:

  image: python:2.7.13-stretch

with the same results.

I gather that the python container isn’t running, so Codeship cannot link that back to my app_container image?
Is there a way to get the python container to run?


Hey @Lody,

do you need the Python environment and the headless Chrome to be available in the same container? (It is a bit unusual to have your main application container link to another container based on an image for a programming language. In most cases your would link to services, like a database or a queue.)

If you could tell me more about your use case, and which command you’re trying to run, I can provide you with pointers and help on how to get there.

(Just from a formal validation point of view, the above services file is correct. But since the python container doesn’t run any daemon, it exits and shuts down pretty soon after startup, which causes the error message that you see.)


Hi Marko,

Thank you for the explanation, I hadn’t thought about the container shutting down after startup, I just thought it didn’t run at all…

I’m trying to build a front-end application. Python is a dependency for the build script (I believe it was node-sass that needed it), and the unit tests are run in Karma using Chrome (headless) as browser.

As I read the documentation here about the services file, I thought it would be a good place to define such dependencies for your container. But your suggesting creating a Dockerfile that contains Node, Python and Chrome from the start?


Yeah, to get started I would create a Dockerfile that contains all the required tools to run your tests. I would base it on your main programming language (which seems to be Node.js`), as this will allow you to easily switch versions and then install the default versions of any other tools you need into that same image.

Once you’ve got the build up and running, you can start optimizing the Dockerfile, by following the tips at and

And once you’ve done that, you can decide whether you still want to pull out individual bits into separate containers. But in most cases this isn’t even required.


Thanks for the links, I’ll check those out.
But, in general, linking containers is more for background services you’d need running for the build?


Yeah, exactly. The syntax for the codeship-services.yml file borrows heavily from Docker Compose. Compose is a tool for defining how to run a full application via Docker, so you’d link services like your database, or queue services (or a backend API service, …)


Got it! I’ll check out the resources you send and modify my Dockerfile.

Thanks Marko!