# How to get a new Docker image to Sandbox

Docker containers enable you to roll up all the files and other dependencies needed to run an application/tool in a separate system isolated from all other processes on your computer. A container image refers to a file system holding these necessary folders and files.

**To learn more about Docker** visit [Docker get started page](https://docs.docker.com/get-started/) and see [Docker tutorial video](https://www.youtube.com/watch?v=iqqDU2crIEQ).

If you want to run a tool in your sandbox that might require the installation and assembly of many files, then we offer you the option to import and run it as a Docker container.

**To access Docker,** open Terminal Emulator from the Application dropdown menu at Sandbox desktop. To see all Docker commands and options available, type

```
:~$ docker --help
```

#### **To see** **options** for **pull command**

```
:~$ docker pull --help
```

#### **To** **pull an image or a repository from a registry**

```
:~$ docker pull path/to/repository
```

An example:

```
:~$ docker pull eu.gcr.io/finngen-sandbox-v3-containers/bioinformatics:1.0.1
```

#### **To list Docker images**

```
:~$ docker images
```

```
REPOSITORY             TAG       IMAGE ID       CREATED       SIZE
path/to/repository     1.0.1      i1m2a3g4e5   2 years ago    3.91GB
```

Assign a name (here "tools") to the container and run Docker container in background (-d option) keeping STDIN open (-i option) and allocating a pseudo-TTY (-t option)

```
:~$ docker run -dit --name tools i1m2a3g4e5
```

#### **To list containers those are running**

```
:~$ docker ps
```

```
CONTAINER ID   IMAGE           COMMAND      CREATED          STATUS          PORTS     NAMES
c1on2ta3ine4r   i1m2a3g4e5   "/bin/bash"   3 minutes ago   Up 3 minutes                tools
```

#### **To stop container**

```
:~$ docker stop tools
```

To list stopped containers

```
:~$ docker ps -a
```

```
CONTAINER ID   IMAGE          COMMAND       CREATED         STATUS                          PORTS        NAMES
c1on2ta3ine4r   i1m2a3g4e5   "/bin/bash"   4 minutes ago   Exited (0) About a minute ago    tools
```

#### To start the run again

```
:~$ docker start tools
```

To attach local standard input, output and error streams to a running container image

```
:~$ docker attach tools
```

returns (if nothing seems to happen press enter again):

```
root@01r23o45o67t:/#
```

#### List folders in the container

```
:/# ls
```

```
bin  boot  dev  etc  home  lib  lib32  lib64  liftover  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
```

You can enter a folder typing cd folder\_name e.g.

```
:/# cd home
```

####

#### To go back to the upper folder

```
:/# cd ..
```

Check that plink is runnable within the image:

```
:/# plink
```

```
PLINK v1.90b6.9 64-bit (4 Mar 2019)            www.cog-genomics.org/plink/1.9/
(C) 2005-2019 Shaun Purcell, Christopher Chang   GNU General Public License v3
  plink <input flag(s)...> [command flag(s)...] [other flag(s)...]
  plink --help [flag name(s)...]
Commands include --make-bed, --recode, --flip-scan, --merge-list,
--write-snplist, --list-duplicate-vars, --freqx, --missing, --test-mishap,
--hardy, --mendel, --ibc, --impute-sex, --indep-pairphase, --r2, --show-tags,
--blocks, --distance, --genome, --homozyg, --make-rel, --make-grm-gz,
--rel-cutoff, --cluster, --pca, --neighbour, --ibs-test, --regress-distance,
--model, --bd, --gxe, --logistic, --dosage, --lasso, --test-missing,
--make-perm-pheno, --tdt, --qfam, --annotate, --clump, --gene-report,
--meta-analysis, --epistasis, --fast-epistasis, and --score.
'plink --help | more' describes all functions (warning: long).
```

#### To exit from the image

```
:/# exit
```

#### List stopped containers

```
:~$ docker ps -a
```

```
CONTAINER ID   IMAGE          COMMAND       CREATED         STATUS                          PORTS        NAMES
c1on2ta3ine4r   i1m2a3g4e5   "/bin/bash"   10 minutes ago   Exited (0) About a minute ago    tools
```

#### Remove container

```
:~$ docker rm tools
```

#### Check that container is removed

```
:~$ docker ps -a
```

```
CONTAINER ID   IMAGE          COMMAND       CREATED         STATUS                          PORTS        NAMES
```

#### Remove the image

```
:~$ docker rmi i1m2a3g4e5
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.finngen.fi/working-in-the-sandbox/quirks-and-features/docker-images/how-to-get-a-new-docker-image-to-sandbox.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
