I'm trying to build and run a docker image with docker-compose up
However, I get the error can't open /config/config.template: no such file
My Dockerfile is as follows:
FROM quay.io/coreos/clair-git
COPY config.template /config/config.template
#Set Defaults
ENV USER=clair PASSWORD=johnnybegood INSTANCE_NAME=postgres PORT=5432
RUN apk add gettext
CMD envsubst < /config/config.template > /config/config.yaml && rm -f /config/config.template && exec /clair -config=/config/config.yaml
ENTRYPOINT []
when adding the line RUN ls -la /config/
the following is returned after running docker-compose up --build
:
drwxr-xr-x 2 root root 4096 Sep 16 06:46 .
drwxr-xr-x 1 root root 4096 Sep 16 06:46 ..
-rw-rw-r-- 1 root root 306 Sep 6 05:55 config.template
Here is the error:
clair_1_9345a64befa1 | /bin/sh: can't open /config/config.template: no such file
I've tried changing line endings and checking the docker version. It seems to work on a different machine running a different OS.
I'm using Ubuntu 18.04 and have docker version docker-compose version 1.23.1, build b02f1306
My docker-compose.yml file:
version: '3.3'
services:
clair:
build:
context: clair/
dockerfile: Dockerfile
environment:
- PASSWORD=johnnybegood
- USER=clair
- PORT=5432
- INSTANCE=postgres
ports:
- "6060:6060"
- "6061:6061"
depends_on:
- postgres
postgres:
build:
context: ../blah/postgres
dockerfile: Dockerfile
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=johnnybegood
- POSTGRES_USER=clair
- POSTGRES_DB=clair