Jenkins in Docker container (run docker pipeline) : <p>I want to run Jenkins in Docker container. Everything is OK. I can run it like this: <code>docker run -d --name jenkins -t -i -p 49001:8080 jenkins</code> I can also add persistent storage. The problem came when I created a pipeline can has to execute <code>docker</code> commands (<code>build</code> and <code>push</code>). First the error was that docker wasn't installed on the system. Yes, expected. Then I started searching and found out how I can run docker in container (passing 2 persistent volumes): <code>docker run ... -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -p 49001:8080 jenkins</code></p>

<p>This runs, but with some exceptions. There is <code>docker</code> command in the container but when I try to run it, it throws an exception: <code>docker: error while loading shared libraries: libltdl.so.7: cannot open shared object file: No such file or directory</code></p>

<p>How can I fix this problem? What is the correct way for installing Jenkins in Docker and run Docker in it? I think there are 2 ways:</p>

<ol>
<li>The one that I am doing - use the sockets</li>
<li>I can expose the docker api that allows connections and running commands</li>
</ol>

<p>Actually is it worth running Jenkins in Docker? I tried to install the missing lib manually from the <code>apt-get</code> It works but I know that it's not the correct way..</p>
