title: docker-compose execute command
body: <p>I'm trying to put some commands in my <code>docker-compose</code> file to be ran in my container and they don't work.</p>
  
  <p>I map a volume from host to container where I have a Root certificate, all I want to do is to run this command <code>update-ca-certificates</code>, so it will  updates the directory /etc/ssl/certs with my cert in the container, however it is not happening. </p>
  
  <p>I tried to solve this in a Dockerfile and I can see that the command runs, but it seems that the cert is not present there and just appears after I login to the container.</p>
  
  <p>What I end doing is to get into the container, then I run the needed commands  manually.</p>
  
  <p>This is the piece of my <code>docker-compose</code> file that I have been trying to use:</p>
  
  <pre><code>build:
        context: .
        dockerfile: Dockerfile
      command: &gt;
        sh -c "ls -la /usr/local/share/ca-certificates &amp;&amp;
               update-ca-certificates"
      security_opt:
        - seccomp:unconfined
      volumes:
        - "c:/certs_for_docker:/usr/local/share/ca-certificates"
  </code></pre>
  
  <p>In the same way I cannot run <code>apt update</code> or anything like this, but after connecting to the container with <code>docker exec -it test_alerting_comp /bin/bash</code> I can pull anything from any repo.</p>
  
  <p>My goal is to execute any needed command on building time, so when I login to the container I have already the packages I will use and the Root cert updated, thanks.</p>