dockerfile
FROM mongo:7.0.5
RUN openssl rand -base64 756 > /mongodb.key
RUN chmod 400 /mongodb.key
RUN chown 999:999 /mongodb.key
CMD ["exec", "docker-entrypoint.sh", "$$@"]
Docker
복사
bash - build
REPO="docker.stdlib.in"
TAG="$REPO/mongo:7.0.5"
docker build \
-t "$TAG" \
-f mongo7.dockerfile .
docker push "$TAG"
Bash
복사
Docker-compose
version: "3.8"
services:
mongo7:
image: docker.stdlib.in/mongo:7.0.5
container_name: mongo
command: [
"mongod",
"--bind_ip_all",
"--keyFile", "/mongodb.key",
"--wiredTigerCacheSizeGB", "2",
]
environment:
TZ: "utc"
MONGO_INITDB_ROOT_USERNAME: "root"
MONGO_INITDB_ROOT_PASSWORD: "local!123"
ports:
- "27017:27017"
networks:
- local
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"
networks:
local:
driver: bridge
YAML
복사