Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keytool error: Certificate not imported, alias <RootCA> already exists #1

Open
erosenberg opened this issue Nov 15, 2020 · 1 comment

Comments

@erosenberg
Copy link

I'm trying to run this with a docker-compose file and keep getting this error:

From the logs:

The PKCS#12 bundle is at "/certs/server.p12" ✅
The legacy PKCS#12 encryption password is the often hardcoded default "changeit" ℹ️
Creating truststore...
keytool error: java.lang.Exception: Certificate not imported, alias <RootCA> already exists

Then the container just restarts infinitely.

version: "3.7"

services:
  mkcert:
    container_name: mkcert
    image: nmasse/mkcert
    restart: unless-stopped
    hostname: mkcert
    environment:
       SERVER_HOSTNAMES: "my-comp.lan localhost"
    volumes:
      - ./mkcert:/certs

Any ideas on what to try next?

@erosenberg
Copy link
Author

I figured out this was because I had specified it to restart unless-stopped, when it should probably just be the default no, so that it runs only once.
I believe it worked successfully, however I got this warning that seems more related to mkcert than your project.

mkcert | Certificate was added to keystore
mkcert | Warning:
mkcert | The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore /certs/keystore.jks -destkeystore /certs/keystore.jks -deststoretype pkcs12".
mkcert exited with code 0

Either way, the service has been changed to this and it seems to work other than the warning message:

mkcert:
    container_name: mkcert
    image: nmasse/mkcert
    # restart: unless-stopped
    hostname: mkcert
    environment:
      SERVER_HOSTNAMES: "my-comp.lan localhost"
    volumes:
      - ./mkcert:/certs

Just posting this here in case it helps anyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant