Docker Community Forums

Share and learn in the Docker community.

No volume container mounted when creating image with docker-compose


(Bjaysheel) #1

Hi,
I am a complete noob with docker. I have gone through the 3 self pace tutorials as well but can’t seem to setup an image as I want to.

Objective:

     Use docker-compose to setup a storage container and a main executions container where scripts (PERL scripts) would run.
     I would like to use docker-compose to create two containers storage and main. Storage container create a volume /analysis and Main container uses volume-from: - storage (storage container will eventually do lot more, such as download public databases from NCBI, install tool to be accessed by various other containers)
     Once the image is created end user will issue
docker run -v /host/input:/input PROJECTNAME_main
to run the pipeline on the given input

Here is my Dockerfile and docker-compose code so far.

docker-compose.yml

storage:
volumes:
- /analysis
container_name: analysis-storage
image: ubuntu:latest

main:
container_name: analysis-main
volumes_from:
- storage
build: .

Docker file

FROM ubuntu:latest

RUN apt-get update
RUN chmod +x /analysis/src/*.pl
RUN /analysis/src/docker_setup.pl

Issue:
When i run docker -v /host/input:/input IMAGENAME I don’t see /analysis volume. I assume there is something I am missing but don’t know what.

Could you please point me in the right direction, perhaps an example on how to achieve this would be great.

Thank you
Jaysheel