Custom Docker Image Build Error

Hi, I’m creating my first workflow with a custom docker image that contains an entrypoint.

Just for conceptual purposes, all my Dockerfile does is pull the alpine image, and then call the entrypoint, which simply echo’s a string.

However, when I include the docker image in my workflow, I get the following error:

CircleCI was unable to run the job runner because we were unable to execute commands in build container.
This typically means that the build container entrypoint or command is terminating the container prematurely, or interfering with executed commands. Consider clearing entrypoint/command values and try again.

Is there something that I’m missing in my workflow/Dockerfile?

Dockerfile:

FROM alpine:3.8

LABEL com.circleci.preserve-entrypoint=true
ENTRYPOINT ["bash", "/entrypoint.sh"]

entrypoint.sh:

#!/bin/sh -l

echo "IN ENTRYPOINT"

config.yml:

version: 2.1

jobs:
  build:
    docker:
      - image: nightfallai/nightfall_dlp:entrypoint_test_10
    steps:
      - setup_remote_docker
      - run:
          name: Code Has Arrived
          command: |
            ls -la

workflows:
  test_only:
    jobs:
      - build

When I replace the ENTRYPOINT with CMD instead, the steps run (no build error occurs), but I don’t see the echo output anywhere, which seems to suggest that entrypoint.sh is not being run. How can I achieve this with either ENTRYPOINT/CMD?

Thanks!

Looking at the docs again, it says

Note: Entrypoints should be commands that run forever without failing. If the entrypoint fails or terminates in the middle of a build, the build will also terminate. If you need to access logs or build status, consider using a background step instead of an entrypoint.

Is my build failing because the entrypoint command (just an echo), does not run forever? If this is the case, how do I run the docker image’s shell script from the circle workflow (and see the output in the circle workflow console)?

This has been resolved. I ended up using my current image as a dependency image, which ran the entrypoint.

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