Giter Club home page Giter Club logo

docker-alpine-mongo's Introduction

This project is now archived. Development has stopped since mongodb has been removed from alpinelinux packages due to SPL license.

license_badge docker_build_badge idocker_image_badge docker_pulls_badge

This repository contains Dockerfile for MongoDB 4.0 container, based on the Alpine edge image.

Install

As a prerequisite, you need Docker to be installed.

To download this image from the public docker hub:

$ docker pull mvertes/alpine-mongo

To re-build this image from the dockerfile:

$ docker build -t mvertes/alpine-mongo .

Usage

To run mongod:

$ docker run -d --name mongo -p 27017:27017 mvertes/alpine-mongo

You can also specify the database repository where to store the data with the volume -v option:

$ docker run -d --name mongo -p 27017:27017 \
  -v /somewhere/onmyhost/mydatabase:/data/db \
  mvertes/alpine-mongo

To run a shell session:

$ docker exec -ti mongo sh

To use the mongo shell client:

$ docker exec -ti mongo mongo

The mongo shell client can also be run its own container:

$ docker run -ti --rm --name mongoshell mongo host:port/db

Limitations

  • On MacOSX, volumes located in a virtualbox shared folder are not supported, due to a limitation of virtualbox (default docker-machine driver) not supporting fsync().

docker-alpine-mongo's People

Contributors

cabaalexander avatar deniscarriere avatar mvertes avatar viktor-ku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-alpine-mongo's Issues

Mongod 3.6.10 `mongod` command fails to run

I attempted to build the dockerfile for this repo, which succeeded but any attempt to run mongod after build fails with error related to wiredtrap.

  • Systems:
    OS: Mac OS X, High Sierra

  • Docker Info:

Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 114
Server Version: 17.09.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: moby
ID: U223:L6QU:WR6Z:R6HP:4SSG:KX6U:SD33:YSF6:63GB:YO3B:6FUC:EC6Q
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 40
 Goroutines: 78
 System Time: 2018-01-07T11:48:24.3189442Z
 EventsListeners: 2
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
  • Logs
 (docker-alpine-mongo:master) docker build -t alpine-mongos .
Sending build context to Docker daemon  70.66kB
Step 1/7 : FROM alpine:edge
 ---> bf9187896446
Step 2/7 : RUN apk add --no-cache mongodb && rm /usr/bin/mongoperf
 ---> Running in e6cd9594a304
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
WARNING: This apk-tools is OLD! Some packages might not function properly.
(1/15) Installing boost-system (1.62.0-r5)
(2/15) Installing libgcc (6.4.0-r6)
(3/15) Installing boost-filesystem (1.62.0-r5)
(4/15) Installing libbz2 (1.0.6-r6)
(5/15) Installing boost-iostreams (1.62.0-r5)
(6/15) Installing boost-program_options (1.62.0-r5)
(7/15) Installing pcre (8.41-r1)
(8/15) Installing libstdc++ (6.4.0-r6)
(9/15) Installing libpcrecpp (8.41-r1)
(10/15) Installing db (5.3.28-r0)
(11/15) Installing libsasl (2.1.26-r11)
(12/15) Installing snappy (1.1.4-r2)
(13/15) Installing wiredtiger-libs (2.9.3.3.6.0-r0)
(14/15) Installing yaml-cpp (0.5.3-r4)
(15/15) Installing mongodb (3.6.1-r0)
Executing mongodb-3.6.1-r0.pre-install
Executing busybox-1.27.2-r6.trigger
OK: 150 MiB in 26 packages
 ---> d276689716b3
Removing intermediate container e6cd9594a304
Step 3/7 : VOLUME /data/db
 ---> Running in 264f7a572473
 ---> 10631f1bc583
Removing intermediate container 264f7a572473
Step 4/7 : EXPOSE 27017 28017
 ---> Running in 8b5c02fc6203
 ---> 7e37c0b54612
Removing intermediate container 8b5c02fc6203
Step 5/7 : COPY run.sh /root
 ---> 1c0a8f33b1cd
Step 6/7 : ENTRYPOINT /root/run.sh
 ---> Running in f1144876bc43
 ---> 6887ef42769b
Removing intermediate container f1144876bc43
Step 7/7 : CMD mongod
 ---> Running in 52267d8a7171
 ---> 0075248a4070
Removing intermediate container 52267d8a7171
Successfully built 0075248a4070
Successfully tagged alpine-mongos:latest
ϟ (docker-alpine-mongo:master) docker run -it --rm alpine-mongos
2018-01-07T11:45:38.629+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=6c08dccc4354
2018-01-07T11:45:38.642+0000 I CONTROL  [initandlisten] db version v3.6.1
2018-01-07T11:45:38.642+0000 I CONTROL  [initandlisten] git version: 025d4f4fe61efd1fb6f0005be20cb45a004093d1
2018-01-07T11:45:38.642+0000 I CONTROL  [initandlisten] OpenSSL version: LibreSSL 2.6.3
2018-01-07T11:45:38.643+0000 I CONTROL  [initandlisten] allocator: system
2018-01-07T11:45:38.643+0000 I CONTROL  [initandlisten] modules: none
2018-01-07T11:45:38.643+0000 I CONTROL  [initandlisten] build environment:
2018-01-07T11:45:38.643+0000 I CONTROL  [initandlisten]     distarch: x86_64
2018-01-07T11:45:38.643+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2018-01-07T11:45:38.643+0000 I CONTROL  [initandlisten] options: {}
2018-01-07T11:45:38.644+0000 I STORAGE  [initandlisten]
2018-01-07T11:45:38.644+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-01-07T11:45:38.644+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-01-07T11:45:38.645+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=487M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-01-07T11:45:38.651+0000 E STORAGE  [initandlisten] WiredTiger error (22) [1515325538:651169][1:0x7f376f3b38d0], wiredtiger_open: Verbose option specified when WiredTiger built without verbose support. Add --enable-verbose to configure command and rebuild to include support for verbose messages: Invalid argument
2018-01-07T11:45:38.651+0000 F -        [initandlisten] Fatal Assertion 28561 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 410
2018-01-07T11:45:38.651+0000 F -        [initandlisten]

***aborting after fassert() failure

Add mongo client shell

How can I install just a mongo client shell on docker alpine using which I can connect to mongodb on another server?
This is to reduce the size of my image.

Issue building the image with ADD run /

Hi thanks for sharing you job.

I having a issue building the image specifically at

Step 2 : ADD run /
lstat run: no such file or directory

do you know why?

Does this container need an init system?

As a matter of course, I have been adding this init system into my container Dockerfiles. Without an init system, they were previously slow to stop, and I found the reason was that gentle kill signals were not working, and so Docker was forced to resort to more aggressive kills to stop such containers.

I have found that mvertes/alpine-mongo is also slow to stop, and presume that the same reason applies. Should, and can, an init system be added? I may do this myself in my inheriting Dockerfile, but it seems sensible to do this upstream if possible.

Best way to set up authentication

Thanks for this container - I'd ideally use it within a docker-compose based network and not have it publicly facing at all but I'm testing out zeit.co's now tool and it only supports a single Dockerfile or package.json.

The simplest approach in my mind is to add some environment variables for a user & password that can be overridden on run/deploy. If set then we can enable auth with those details.

Is this something you'd want to support directly in this repo or are there other better approaches you can think of?

Latest tag broken

The latest push to Dockerhub is broken.

Error relocating /usr/bin/mongod: _ZNK5boost16re_detail_10600031cpp_regex_traits_implementationIcE17transform_primaryEPKcS4_: symbol not found
Error relocating /usr/bin/mongod: _ZNK5boost16re_detail_10600031cpp_regex_traits_implementationIcE9transformEPKcS4_: symbol not found

Image with 3.6.4-0 fails to start

The latest version upgrade to 3.6.4-0 breaks the container.
Log output:

E STORAGE  [initandlisten] WiredTiger error (22) [1523880149:173900][1:0x7fd16a8debd0], wiredtiger_open: unknown configuration key: 'cache_cursors': Invalid argument

Why Alpine Edge?

I understand that at one stage Alpine Edge was the only version to offer the mongodb package.

However Apline release v3.8 has mongodb:3.6.7-r0, and the newest Alpine v3.9 has mongodb:4.0.5-r0.

Would you consider releasing versions of this container based on Alpine v3.9 for those who prefer to not use Edge?

Share port to real OS

Hello everyone

How can I forward mongo port (27017) to a real OS to localhost?

I try to do this, but I had not succeed:

  mongo:
    image: 'mongo:latest'
    restart: always
    expose:
      - 27017
    ports:
      - 27017:27017
# ......

Crashes on collection.drop()

Hey there, I'm trying to use this mongo container but it will crash everytime I do a drop() on a collection.
Here is how to to repro:

> use mydb
switched to db mydb
> db.some.insertOne({'ding' : 'dong'});
{
    "acknowledged" : true,
    "insertedId" : ObjectId("56d17d0fa673ea32ea9117a5")
}
> db.some.drop();

Add bind_ip option for 3.6 version.

As stated in logs messages and in Upgrade a Standalone to 3.6 mongod by default now binded at 127.0.0.1 which is make it not visible outside of Docker (does not case for Kubernetes).
So I suggest to lauch mongo (in run.sh) as

mongod --bind_ip 0.0.0.0

by default to be consistent with previous version of your docker image.

--auth

not find
docker run --name mongo -p 27017:27017 -v /tumor/mongo/db:/data/db
-v /etc/localtime:/etc/localtime
--restart=always -d mvertes/alpine-mongo --auth
help me

How do I pass command line options to mongod

Apologies if this is a stupid question however I can't see a way to pass command line options to mongod. ex. docker .... mvertes/alpine-mongo --smallfiles gives /run: exec: line 3: --smallfiles: not found

I am using Docker on Windows and am not a Linux guy and am new to Docker. Best I can work out is this is an issue with the run script.

Does this build support TLS/SSL connections

I'm trying to configure SSL connectivity, but I get the following error:

Unrecognized option: net.ssl.mode when I try to start mongod pointing to a config file with ssl enabled.

Do you know whether the underlying mongod binary was compiled with ssl support?

MongoDB shell error

When accessing the container via

docker exec -it mongodb /bin/sh

and executing just mongo or any of the provided cli/shell functions, I get the following error:

/ # mongo --verbose
MongoDB shell version: 3.2.1
too much recursion
2016-02-14T21:49:01.670+0000 D -        [thread1] User Assertion: 139:Failed to initialize JSContext
2016-02-14T21:49:01.690+0000 D -        [main] User Assertion: 139:Failed to initialize JSContext
exception: Failed to initialize JSContext

Update: Above mongo command now with --verbose flag.

After some searching to see if I can find the source of this error, I found the following definition:

Objective-CJSContext is an environment for running JavaScript code. A JSContext instance represents the global object in the environment—if you’ve written JavaScript that runs in a browser, JSContext is analogous to window. Source: NSHipster

Going down the rabbit hole, I looked up what an Assertion is in Objective-C and found that it throws an Exception in case the assertion fails. I'm assuming that the too much recursion error happened first and caused the program to break. As I saw that the first error is actually an Internal Error in the JavaScript core, I now assume that there's some internals broken and not the JSContext not being available in Alpine in this scenario.

Found a similar error in the following repo/issue: gliderlabs/docker-alpine#137 (cross referenced).

"Fatal Assertion" with "fsync: Invalid Argument"

After a quick try to pull this container in with Docker Compose up, the following error (about the WiredTiger package) can be found in the logs:

$ docker-compose logs

db_1  | 2016-02-11T12:30:54.530+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=df7349b3db2d
db_1  | 2016-02-11T12:30:54.530+0000 I CONTROL  [initandlisten] db version v3.2.1
db_1  | 2016-02-11T12:30:54.530+0000 I CONTROL  [initandlisten] git version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2
db_1  | 2016-02-11T12:30:54.530+0000 I CONTROL  [initandlisten] allocator: system
db_1  | 2016-02-11T12:30:54.530+0000 I CONTROL  [initandlisten] modules: none
db_1  | 2016-02-11T12:30:54.530+0000 I CONTROL  [initandlisten] build environment:
db_1  | 2016-02-11T12:30:54.530+0000 I CONTROL  [initandlisten]     distarch: x86_64
db_1  | 2016-02-11T12:30:54.530+0000 I CONTROL  [initandlisten]     target_arch: x86_64
db_1  | 2016-02-11T12:30:54.530+0000 I CONTROL  [initandlisten] options: {}
db_1  | 2016-02-11T12:30:54.535+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
db_1  | 2016-02-11T12:30:54.539+0000 E STORAGE  [initandlisten] WiredTiger (22) [1455193854:539175][1:0x7f2b9d5c0808], connection: /data/db/WiredTiger.wt: fsync: Invalid argument
db_1  | 2016-02-11T12:30:54.541+0000 I -        [initandlisten] Fatal Assertion 28561
db_1  | 2016-02-11T12:30:54.541+0000 I -        [initandlisten] 
db_1  | 
db_1  | ***aborting after fassert() failure

The docker-compose.yml file part:

db:
    image: mvertes/alpine-mongo
    volumes:
        - ./db:/data/db
    ports:
        - 27017

The Volume mapping successfully adds to the local FS the following structure:

\~
 |- /journal
 |- mongodb.lock
 |- WiredTiger
 \- WiredTiger.lock

… with the following contents – the mongodb.lock and the /journal folder stay empty:

# WiredTiger
WiredTiger
WiredTiger 2.7.0: (December  8, 2015)

# WiredTiger.lock
WiredTiger lock file

The error is repeatable.
System: Docker on OS X via default Docker-Machine:

$ docker-machine -v
docker-machine version 0.5.1 (7e8e38e)

$ docker -v
Docker version 1.9.1, build a34a1d5

$ docker-compose -v
docker-compose version: 1.5.1

alpine mongoldb-shell package needed

Hi,
any chance to get the mongodb-org-shell package on alpine? The primary use would be to be to install it ontop of a i.e nodejs alpine image and connect to another docker container running alpine mongodb...
Thanks a lot
Ognian

issue building the image getting fetching APKINDEX.tar.gz: IO ERROR

I got the following error building the image:

`
Step 3 : ADD https://raw.githubusercontent.com/mvertes/dosu/0.1.0/dosu /sbin/
Downloading 174 B

---> Using cache
---> 886223a4f851
Step 4 : RUN chmod +x /sbin/dosu && echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && apk add --no-cache mongodb
---> Running in 946fc71a85d1
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz: IO ERROR
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz: IO ERROR
fetch http://dl-4.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-4.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz: IO ERROR
ERROR: unsatisfiable constraints:
mongodb (missing):
required by: world[mongodb]
The command '/bin/sh -c chmod +x /sbin/dosu && echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && apk add --no-cache mongodb' returned a non-zero code: 1

`

Broken docker image uploaded recently

The most recent image of mvertes/alpine-mongo appears to contain Mongo 3.6.7, not Mongo 4.0.6, as expected.

image

For comparison, here's with the 4.0.5-0 tag:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.