0

I'm trying to add SSL support to my custom docker image. This is my Dockerfile:

FROM selenium/standalone-chrome-debug:3.141.59-yttrium

# Switch to root user
USER root

# Add SSL support for stripe
# https://docs.lando.dev/config/security.html#certificates
RUN cp lndo.site.pem lndo.site.crt /usr/local/share/ca-certificates
RUN update-ca-certificates

However, this causes the build to fail:

Step 4/5 : RUN cp lndo.site.pem lndo.site.crt /usr/local/share/ca-certificates
---> Running in 112093a612fe
[91mcp: cannot stat 'lndo.site.pem': No such file or directory
cp: cannot stat 'lndo.site.crt': No such file or directory

The files lndo.site.pem and lndo.site.crt are committed to the same repository as my Dockerfile.

I found this answer to adding certs to a local docker build, but I am trying to do the same thing for Docker Hub, so my question is different.

What is the path for the files in the repo for use in the Dockerfile?

Structure of my Github repo that I am using to build the image on Docker Hub:

  - Dockerfile
  - README.md
  - lndo.site.crt
  - lndo.site.pem
Patrick Kenny
  • 4,515
  • 7
  • 47
  • 76

2 Answers2

1

Are you sure about that files lndo.site.pem and lndo.site.crt is exist on that directory?

On your Dockerfile I see a command:

RUN cp lndo.site.pm lndo.site.crt /usr/local/share/ca-certificates

You are looking for file lndo.site.pem but on your Dockerfile there is a missing character maybe

lndo.site.pm -> lndo.site.pem

I think you should sure about that you are copying the certificate files to your container image(on your Dockerfile)

ezileli
  • 174
  • 2
  • 6
  • Thanks, I fixed that typo, but I'm still getting the same error. I added some more info about the structure of my Github repo to the question. The problem is that I don't know which path to use for the files in my Github repo in the Dockerfile. – Patrick Kenny Sep 12 '20 at 09:05
  • 1
    OK then I suggest you to add this command to your Dockerfile above of `RUN cp lndo.site.pem lndo.site.crt /usr/local/share/ca-certificates` command. `COPY lndo.site.crt lndo.site.pem ./` – ezileli Sep 12 '20 at 09:10
0

Based on @ezileli's comment, I was able to find the solution:

FROM selenium/standalone-chrome-debug:3.141.59-yttrium

# Switch to root user
USER root

# Add SSL support for stripe
# https://docs.lando.dev/config/security.html#certificates
COPY lndo.site.pem lndo.site.crt /certs
RUN update-ca-certificates
Patrick Kenny
  • 4,515
  • 7
  • 47
  • 76