Question: I'm hoping to use docker to set up some bioinformatic analysis.

I have found two docker images that I would like to use:

1. jupyter/datascience-notebook
2. bioconductor/devel\_base

I have been successful in running each of these images independently, however I don't know how to merge them together.

Is merging two docker containers possible? Or do you start with one, and then manually install the features of the other?

Answer: 
You can't just merge the images. You have to recreate your own based on what was in each of the images you want. You can download both images and re-create the Docker files for each like this:

```
docker history --no-trunc=true image1 > image1-dockerfile
docker history --no-trunc=true image2 > image2-dockerfile

```

Substitute the image1 and image2 with the images you want to see the history for. After this you can use those dockerfiles to build your own image that is the combination of the two.

The fly in the ointment here is that any ADD or COPY commands will not reveal what was copied because you don't have access to the local file system from which the original images were created. With any luck that won't be necessary or you can get any missing bits from the images themselves.
If there are specific files or directories that you want to cherry-pick from the one of the two images, you can create a new Dockerfile that builds `FROM` one of them and copy over specific paths from the other using [COPY's --from option](https://docs.docker.com/engine/reference/builder/#copy). For example:

```
FROM bioconductor/devel_base
COPY --from=jupyter/datascience-notebook /path/to/something-you-want /path

```

However, a quick investigation of those images shows that in this specific case there isn't a lot that can easily be cherry picked.

Alternatively, you can just look at the original Dockerfiles and combine them yourself:

* <https://github.com/jupyter/docker-stacks/blob/master/base-notebook/Dockerfile>
* <https://github.com/Bioconductor/bioc_docker/blob/master/out/devel_base/Dockerfile>

Fortunately they are both based one APT-based distros: Ubuntu and Debian. So most of the apt-get install commands should work fine if you pick either base image.