pattern icon indicating copy to clipboard operation
pattern copied to clipboard

Issue with Docker and CA cert using mkcert

Open nursetta opened this issue 3 years ago • 5 comments

I am running a docker instance and following the tutorial. I get the following error when running make start. The error seems to be specific to the client where it cannot find the .pem files despite the certs living at the root of the client folder. I can remove "SL_CRT_FILE=localhost.pem SSL_KEY_FILE=localhost-key.pem" from my package.json file and the app will start via https, but then I get a security warning. Below is the docker log.

[email protected] start /opt/client

PORT=3001 HTTPS=true SSL_CRT_FILE=localhost.pem SSL_KEY_FILE=localhost-key.pem react-scripts start

Your tsconfig.json has been populated with default values.

You specified SSL_CRT_FILE in your env, but the file "/opt/client/localhost.pem" can't be found.

We detected TypeScript in your project (src/App.tsx) and created a tsconfig.json file for you.

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! [email protected] start: PORT=3001 HTTPS=true SSL_CRT_FILE=localhost.pem SSL_KEY_FILE=localhost-key.pem react-scripts start

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the [email protected] start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

nursetta avatar Apr 29 '22 06:04 nursetta

Here is how the client folder is structured:

Screen Shot 2022-04-29 at 12 40 19 AM

nursetta avatar Apr 29 '22 06:04 nursetta

@nursetta sorry for the delay on this -- are you still experiencing this problem?

phoenixy1 avatar Aug 17 '22 19:08 phoenixy1

@phoenixy1 Thanks for the response. I am still running into this issue.

nursetta avatar Aug 18 '22 14:08 nursetta

@nursetta thank you for your extreme patience! I checked and the instructions were missing a step. I have submitted a PR to add the missing step to the instructions. It is:

In the Dockerfile in the client folder, add these two lines below line 6:

COPY ["localhost-key.pem", "/opt/client"]
COPY ["localhost.pem", "/opt/client"]

phoenixy1 avatar Aug 22 '22 21:08 phoenixy1

instructions update is now merged! Going to close this out now, let me know if it needs re-opening

phoenixy1 avatar Aug 22 '22 22:08 phoenixy1