Skip to content

Commit

Permalink
deploy: 93132aa
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobBerg committed Feb 5, 2025
1 parent 211f868 commit 5aba507
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 7 deletions.
Binary file modified .doctrees/course_contents/HandsOn.doctree
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
41 changes: 37 additions & 4 deletions _sources/course_contents/HandsOn.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,51 @@ Exercise:



Say you have identified a container that you want to run with your scrip, but a key piece of software is missing.
We can modify the container by adding some lines ot code to the Dockerfile which is used to generate the docker image used to spin up the docker container which we will use.


Excercise:
make your own dockerfile inspired by the one above and build it
Not all tools needed can be installed with `apt-get` and we may need to download from a particular URL, luckily we know how to make an image with curl installed.

we can add the following lines in the bottom of our dockerfile to download and extract the tool `salmon`

```
RUN curl -sSL https://github.com/COMBINE-lab/salmon/releases/download/v1.5.2/salmon-1.5.2_linux_x86_64.tar.gz | tar xz \
&& mv /salmon-*/bin/* /usr/bin/ \
&& mv /salmon-*/lib/* /usr/lib/
```

Exercise:
* Build an image with `salmon` installed. Do this by updating your `Dockerfile` accordingly, and build it with the same command as before.
* Check that you have your new image available

Say you have identified a container that you want to run with your scrip, but a key piece of software is missing.
We can modify the container by adding some lines ot code to the Dockerfile which is used to generate the docker image used to spin up the docker container which we will use.


Solution:
Update the `Dockerfile` to have the following content:
```
FROM debian:bullseye-slim
LABEL image.author.name="Your Name Here"
LABEL image.author.email="[email protected]"
RUN apt-get update && apt-get install -y curl
ENV PATH=$PATH:/usr/games/
RUN curl -sSL https://github.com/COMBINE-lab/salmon/releases/download/v1.5.2/salmon-1.5.2_linux_x86_64.tar.gz | tar xz \
&& mv /salmon-*/bin/* /usr/bin/ \
&& mv /salmon-*/lib/* /usr/lib/
```

then run the command
```
docker build -t my-image .
```

finally confirm with
```
docker images
```


38 changes: 36 additions & 2 deletions course_contents/HandsOn.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,44 @@ <h1>Docker Hands-on beginners training<a class="headerlink" href="#docker-hands-
<li><p>Build your docker file to an image</p></li>
<li><p>run the command <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">run</span> <span class="pre">&lt;my-image-name&gt;</span> <span class="pre">cowsay</span> <span class="pre">'Hej</span> <span class="pre">DTU!'</span></code></p></li>
</ul>
<p>Excercise:
make your own dockerfile inspired by the one above and build it</p>
<p>Say you have identified a container that you want to run with your scrip, but a key piece of software is missing.
We can modify the container by adding some lines ot code to the Dockerfile which is used to generate the docker image used to spin up the docker container which we will use.</p>
<p>Not all tools needed can be installed with <code class="docutils literal notranslate"><span class="pre">apt-get</span></code> and we may need to download from a particular URL, luckily we know how to make an image with curl installed.</p>
<p>we can add the following lines in the bottom of our dockerfile to download and extract the tool <code class="docutils literal notranslate"><span class="pre">salmon</span></code></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">RUN</span> <span class="n">curl</span> <span class="o">-</span><span class="n">sSL</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">COMBINE</span><span class="o">-</span><span class="n">lab</span><span class="o">/</span><span class="n">salmon</span><span class="o">/</span><span class="n">releases</span><span class="o">/</span><span class="n">download</span><span class="o">/</span><span class="n">v1</span><span class="mf">.5.2</span><span class="o">/</span><span class="n">salmon</span><span class="o">-</span><span class="mf">1.5.2</span><span class="n">_linux_x86_64</span><span class="o">.</span><span class="n">tar</span><span class="o">.</span><span class="n">gz</span> <span class="o">|</span> <span class="n">tar</span> <span class="n">xz</span> \
<span class="o">&amp;&amp;</span> <span class="n">mv</span> <span class="o">/</span><span class="n">salmon</span><span class="o">-*/</span><span class="nb">bin</span><span class="o">/*</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span> \
<span class="o">&amp;&amp;</span> <span class="n">mv</span> <span class="o">/</span><span class="n">salmon</span><span class="o">-*/</span><span class="n">lib</span><span class="o">/*</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span>
</pre></div>
</div>
<p>Exercise:</p>
<ul class="simple">
<li><p>Build an image with <code class="docutils literal notranslate"><span class="pre">salmon</span></code> installed. Do this by updating your <code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code> accordingly, and build it with the same command as before.</p></li>
<li><p>Check that you have your new image available</p></li>
</ul>
<p>Solution:
Update the <code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code> to have the following content:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>FROM debian:bullseye-slim

LABEL image.author.name=&quot;Your Name Here&quot;
LABEL image.author.email=&quot;[email protected]&quot;

RUN apt-get update &amp;&amp; apt-get install -y curl

ENV PATH=$PATH:/usr/games/

RUN curl -sSL https://github.com/COMBINE-lab/salmon/releases/download/v1.5.2/salmon-1.5.2_linux_x86_64.tar.gz | tar xz \
&amp;&amp; mv /salmon-*/bin/* /usr/bin/ \
&amp;&amp; mv /salmon-*/lib/* /usr/lib/
</pre></div>
</div>
<p>then run the command</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">docker</span> <span class="n">build</span> <span class="o">-</span><span class="n">t</span> <span class="n">my</span><span class="o">-</span><span class="n">image</span> <span class="o">.</span>
</pre></div>
</div>
<p>finally confirm with</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">docker</span> <span class="n">images</span>
</pre></div>
</div>
</section>


Expand Down
Loading

0 comments on commit 5aba507

Please sign in to comment.