> For the complete documentation index, see [llms.txt](https://docs.finngen.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.finngen.fi/working-in-the-sandbox/quirks-and-features/docker-images/how-to-mount-data-into-docker-container-image.md).

# How to mount data into Docker container image

Docker can be used to run applications and process the data in the container independently. This property also enables usage of tools otherwise not compatible with tools inside Sandbox IVM. Reading from input and writing to output data.

Here, as an example, we will copy a file inside a Docker container from input data to output data.

**Open Terminal** Emulatior in Sandbox. Pull docker from bioinformatics folder in Sandbox v3:

```
:~$ 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
```

returns

```
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 attaching mounting, library-red and /home/ivm/ in background (-d option) keeping STDIN open (-i option) and allocating a pseudo-TTY (-t option).

```
:~$ docker run -dit --mount type=bind,source=/folder_where/your/targetfile_is/,target=/input_data,readonly --mount type=bind,source=/home/ivm/,target=/output_data --name tools i1m2a3g4e5
```

Source option will save your path to what you specify with target option.

To attach local standard input, output and error streams to a running container image and to check that the container is there:

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

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

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

**Copy data** from input to output data (named here input\_data and output\_data) inside container:

```
root@01r23o45o67t:/# cp /input_data/file_name.txt output_data/
```

**List folders** in the container (Outputs your home/ivm content plus the file you copied using cp)

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

This will show list of folders and files in your output\_data (here home/ivm) plus the file you just copied.

#### To exit container

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

Now the file you copied is found in "output\_data" folder (in this example home/ivm/)

```
:~$ ls /home/ivm/
```

The copied folder is also visible in File Manager in [Sandbox Desktop](/working-in-the-sandbox/quirks-and-features/navigating-the-sandbox.md).

It should be noted that packages inside the Docker image can be used when attached to that image. Use of other sandbox tools outside Docker image is not possible when attached to the image.

See Samuel Jones user case of Docker image from [FinnGen Users' meeting video 7th Sep 2021](https://www.finngen.fi/en/members/recordings/finngen-data-users-meeting-7th-september-2021).

For more tutorials visit Docker page [Best practices for writing Dockerfiles](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/) and see tutorial video [How to Get Started with Docker](https://www.youtube.com/watch?v=iqqDU2crIEQ).

If you like to use symbolic links with Docker, you can find tutorials for that e.g. from [MYP Java Docker Logging Symlink Hack](http://mvpjava.com/docker-logging-symlink-hack/).
