Skip to content

Docker Newbie question: How to run shell script in docker file (post startup) #191

@ikemtz

Description

@ikemtz

I'm trying to run a mongorestore command as part of my docker file. I'm thinking that this should be a pretty straight forward thing to do.

Here's my docker file:
FROM mongo:latest
RUN mongodump -h xxxxxx -u xxxxx -p xxxxxx --ssl --sslAllowInvalidCertificates -d xxxxx --gzip --archive=DbArchive.archive
EXPOSE 27018:27017
ENV AUTH no
ENV JOURNALING no
RUN mkdir -p /usr/src/db
COPY ./*.sh /usr/src/db/
RUN chmod +x /usr/src/db/restoreDb.sh
#CMD /bin/sh ./usr/src/db/restoreDb.sh

Here's my restoreDb.sh script
sleep 60
mongorestore --archive=DbArchive.archive --gzip --db xxxxxxx

Anyone have any ideas on how to get this to work? I'm just trying to run my mongorestore after the mongo db has started.

When I execute the following scripts I get the following error message:
2017-07-25T00:05:48.352+0000 Failed: error connecting to db server: no reachable servers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions