title: Bad pem file or Docker Desktop permissions
body: <p>My Docker Compose / Mongo container was working with username, password, etc. I decided to add a certificate for more security and to experiment with something new.</p>
  <p>The only way I know how to do this is I have this Docker Compose file that creates my volume.</p>
  <pre><code>services:
      test-mongo:
          container_name: ssltest-mongo        
          image: mongo:4.4.6
          ports:
            - &quot;27017:27017&quot;
          networks:
            - backend
          volumes:
            - MongoDatabase:/data/db
            - MongoDatabase:/data/ssl
          environment:
            - MONGO_INITDB_ROOT_USERNAME=user
            - MONGO_INITDB_ROOT_PASSWORD=pass
            - MONGO_INITDB_DATABASE=defaultDB
          command:
            --tlsMode=requireTLS
            --tlsCertificateKeyFile=/data/ssl/mydomain.pem
            --tlsCAFile=/data/ssl/_wildcard_.mydomain.com.crt
  
      networks:
          backend:
      volumes:
        MongoDatabase:
  </code></pre>
  <p>After <code>docker-compose up</code> my volume is created at \wsl$....\volumes\MongoDatabase</p>
  <p>If I start the container then I get an error when looking for the pem file.</p>
  <blockquote>
  <p>No such file or directory</p>
  </blockquote>
  <p>Well, this makes sense because the file isn't there yet. I haven't learned how to copy files from a local directory to a Docker image volume using <code>docker-compose</code> yet.</p>
  <p>So I manually copy the pem file to the volume location and I get a new error:</p>
  <blockquote>
  <p>error:0909006C:PEM routines:get_name:no start line</p>
  </blockquote>
  <p>This tells me the file IS found but I am uneducated on how to determine if it is a bad pem or a permissions error, or something entirely different.</p>
  <p>I say bad pem because the CA (not self signed) provided me a zip of crt files and I'm not sure which one I should use to generate the pem.</p>
  <p>I say permissions because I am copying a file from windows to a wsl network share....??? and there's a good chance the permissions are not correct.</p>
  <p>So if I comment out the tls stuff my Docker Compose runs again and I can use the cli to browse to my volume copy my pem over again and read the permissions.</p>
  <blockquote>
  <p>-rw-r--r--</p>
  </blockquote>
  <p>If I understand this correctly the user has read &amp; write but not execute. Well, it seems to me that should be sufficient but I chmod (chmod u=rwx,g=rwx,o=rwx) it anyway.</p>
  <p>I then stop my Docker image. Uncomment the tls stuff and start it back up. Same result.</p>
  <blockquote>
  <p>error:0909006C:PEM routines:get_name:no start line</p>
  </blockquote>
  <p>What can I try next?</p>