Docker Community Forums

Share and learn in the Docker community.

Certificate file difference between COPY and ADD


My need is to import certificates (pem, cer) inside docker container so that JBoss can use it. I am using below code to import the files I received from vendor.

ADD certificate.pem /opt/jboss/cert.pem
ADD certificate.cer /opt/jboss/apicert.cer
RUN update-ca-trust

The above code copies the files inside container “/opt/jboss” but there is nothing present in “/etc/pki/ca-trust/source/anchors/”

But if I use COPY instead of ADD then I do not see any file inside “/opt/jboss”. But I see a file created as “yourcertificate.pem” inside “/etc/pki/ca-trust/source/anchors/”.

Can anybody explain me why is this? Also which one I am supposed to use so that JBoss can access and configure the certificate? Thanks.


Jboss as in Wildfly application server?
Also, are you trying to provide a “server certificate” or just the public part of a certificate for a different server/ca to prevent ssl verification errors when downloading files with curl/wget?