title: Copy letsencrypt files to docker container
body: <p>Im not an expert with docker, I am just getting used to it. I want to copy ssl certificates, which are generated on the host machine to my docker container. I read that it should be able to do with <code>volumes</code> argument in the docker-compose file but starting my server it always excites as it cannot find the copied files within the working directory.</p>
  <p><strong>Folderstructure</strong></p>
  <pre><code>- repo
     - backend
        - api
           - static
              - ssl
           - dockerfile
     - frontend
     - docker-compose.yml
  </code></pre>
  <p><strong>Dockerfile</strong></p>
  <pre><code>FROM node:14-alpine
  
  ENV NODE_ENV=production SERVER_PORT_HTTP=80 SERVER_PORT_HTTPS=443
  
  WORKDIR /usr/src/app
  
  RUN npm install
  
  COPY . .
  
  EXPOSE ${SERVER_PORT_HTTP} ${SERVER_PORT_HTTPS}
  
  CMD [ &quot;npm&quot;, &quot;run&quot;, &quot;start&quot; ]
  </code></pre>
  <p><strong>Docker-Compose</strong></p>
  <pre><code>version: &quot;3&quot;
  
  services:
    api:
      build:
        context: ./backend/api
      ports:
        - &quot;80:80&quot;
        - &quot;443:443&quot;
      volumes:
        - /etc/letsencrypt/live/api.example.com:/static/ssl
      restart: unless-stopped
  </code></pre>