security
and authorization
not a keyword for the docker-compose
YAML file, so take them out of there.
If the file of the file file needs to be copied to the container, you should put something like:
FROM: mongo:2.6.4 ADD /home/ubuntu/dockerlab/keyfile.key /tmp ENV AUTH yes
in the docker file.
And modify the docker-compose.yml
:
image: mongo:2.6.4
in
build: .
and command
value in
command: ["mongod", "--smallfiles", "--keyFile /tmp/keyfile.key" ]
Alternatively, you can use the volume
entry in docker-compose.yml
to map keyfile.key
in your container, and instead of Dockerfile
in the Dockerfile
add , "--auth"
to the sequence, which is the value for command
. Then you can continue to use the stanza image
and completely exclude the Dockerfile
:
db: image: mongo:2.6.4 command: ["mongod", "--smallfiles", "--auth", "--keyFile /tmp/keyfile.key" ] expose: "27017" ports: "27017:27017" volumes: - /home/ubuntu/dockerlab/keyfile.key: /tmp
source share