I'm trying to add a volume to the mattermost/mattermost-preview docker image. The Dockerfile for this image (not controlled by me) is:
# Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
# See License.txt for license information.
FROM mysql:5.7
# Install ca-certificates to support TLS of Mattermost v3.5
RUN apt-get update && apt-get install -y ca-certificates
#
# Configure SQL
#
ENV MYSQL_ROOT_PASSWORD=mostest
ENV MYSQL_USER=mmuser
ENV MYSQL_PASSWORD=mostest
ENV MYSQL_DATABASE=mattermost_test
#
# Configure Mattermost
#
WORKDIR /mm
# Copy over files
ADD https://releases.mattermost.com/4.4.4/mattermost-team-4.4.4-linux-amd64.tar.gz .
RUN tar -zxvf ./mattermost-team-4.4.4-linux-amd64.tar.gz
ADD config_docker.json ./mattermost/config/config_docker.json
ADD docker-entry.sh .
RUN chmod +x ./docker-entry.sh
ENTRYPOINT ./docker-entry.sh
# Create default storage directory
RUN mkdir ./mattermost-data
VOLUME ./mattermost-data
# Ports
EXPOSE 8065
I want to add a volume to this image, and a custom entrypoint so that I can add some test data to the mysql database before my container starts up. I'm trying to use docker-compose to do this:
version: '3'
services:
mattermost:
ports:
- "8065:8065"
image: mattermost/mattermost-preview
volumes:
- ./end_to_end/mattermost/mock-mount:/mm/mock-mount
entrypoint: /mm/mock-mount/docker-entry.sh
But I'm unfortunately not able to get this to start, when I try running docker-compose up
, I get the error
ERROR: for mattermost Cannot create container for service mattermost: invalid bind mount spec "39742853c03b3b2747f11c942a4a76e4cd138ad41d54f70f71d7aa9ccc36dcca:mattermost-data:rw": invalid volume specification: '39742853c03b3b2747f11c942a4a76e4cd138ad41d54f70f71d7aa9ccc36dcca:mattermost-data:rw': invalid mount config for type "volume": invalid mount path: 'mattermost-data' mount path must be absolute
ERROR: Encountered errors while bringing up the project.
The weird thing is - if I take out the volumes
and entrypoint
sections from my docker-compose.yml
file, then the container starts up no problem, even though it seems to me that the error is with the original image. Is there a way to do what I want here?
Copyright License:
Author:「Lily Mara」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/47687893/unable-to-add-volume-to-image-via-docker-compose