How to test a docker volume?

Viewed 5387

I want to test if I did my docker-compose.yml correctly. The new thing is a volume

app:
    image: gitlab-${smt}:5005/smt/my-app:latest
    container_name: app
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - $HOME/.docker:/root/.docker
      - /home/profile_x/compose/area:/home/profile_x/compose/area
    environment:
      #not important for my question
    ports:
      - 80:80
    restart: always

So I added the last volume /home/profile_x/compose/area because my goal is to share it from the Docker host to the Docker container, and to write from the container inside the host.

How can I check if the volume is mounted inside the container app ?

3 Answers

You can make use of google's docker container-structure-tests to write tests to make sure your image is build as per the specifications from Dockerfile.

More information can be found here.

Related