Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mounting named volumes doesn’t work in docker-compose files #97

Closed
bggolding opened this issue Sep 12, 2019 · 0 comments
Closed

Mounting named volumes doesn’t work in docker-compose files #97

bggolding opened this issue Sep 12, 2019 · 0 comments

Comments

@bggolding
Copy link

I believe this is a bug.

When docker-compose tries to mount a named volume, by default it prepends the project’s name to the volume, ie, a named volume “nexus-data” will be mounted as “project_nexus-data”. The direct docker command doesn’t prepend the project name so the two commands don’t access the same data. To make docker-compose use the unmodified name, it needs to be marked as an external container and its name specified.

Please provide a sample input docker run command

docker run -d -p 8081:8081 -p 5000:5000 --name nexus --restart=always -v nexus-data:/nexus-data sonatype/nexus3

What is the current output?*

version: '3.3'
services:
    nexus3:
        ports:
            - '8081:8081'
            - '5000:5000'
        container_name: nexus
        restart: always
        volumes:
            - 'nexus-data:/nexus-data'
        image: sonatype/nexus3

What is the expected/desired output?

version: '3.3'
services:
    nexus3:
        ports:
            - '8081:8081'
            - '5000:5000'
        container_name: nexus
        restart: always
        volumes:
            - 'nexus-data:/nexus-data'
        image: sonatype/nexus3

volumes:
    nexus-data:
        external:
            name: nexus-data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant