docker
Posted yzpopulation
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker相关的知识,希望对你有一定的参考价值。
FROM centos
maintainer Chris Collins <collins.christopher@gmail.com>
LABEL Discription="基于centos的mongodb镜像" version="1.0"
RUN mkdir -p /data/usr/mongodb/{data,logs}
COPY mongodb-org-4.2.repo /etc/yum.repos.d/
RUN dnf update -y && dnf install -y mongodb-org
EXPOSE 27017
COPY mongodb.conf /etc/mongod.conf
RUN systemctl start mongod.service
CMD ["bash"]
ENTRYPOINT "/usr/local/bin/hello"
ADD mongodb-linux-x86_64-4.0.11 /data/usr/mongodb
RUN mkdir /data/usr/mongodb/{data,logs}
ENV PATH /data/usr/mongodb/bin:$PATH
EXPOSE 27017
WORKDIR /data/usr/mongodb/bin/
COPY mongodb.conf .
CMD ["mongod","-f", "mongodb.conf"]
FROM centos
MAINTAINER xiaozhou (xiaozhou@docker.com)
LABEL Discription="基于centos的mongodb镜像" version="1.0"
RUN mkdir -p /data/usr
ADD mongodb-linux-x86_64-rhel80-4.2.5 /data/usr/mongodb
RUN mkdir /data/usr/mongodb/{data,logs}
ENV PATH /data/usr/mongodb/bin:$PATH
EXPOSE 27017
WORKDIR /data/usr/mongodb/bin/
COPY mongodb.conf .
CMD ["mongod","-f", "mongodb.conf"]
FROM alpine
RUN echo -e "https://mirrors.ustc.edu.cn/alpine/latest-stable/main
https://mirrors.ustc.edu.cn/alpine/latest-stable/community" > /etc/apk/repositories && apk update && apk --no-cache add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
RUN apk add --no-cache mongodb
VOLUME /data/db
EXPOSE 27017 28017
COPY run.sh /root
ENTRYPOINT [ "/root/run.sh" ]
CMD [ "mongod", "--bind_ip", "0.0.0.0" ]
run.sh
#!/bin/sh
# Docker entrypoint (pid 1), run as root
[ "$1" = "mongod" ] || exec "$@" || exit $?
# Make sure that database is owned by user mongodb
[ "$(stat -c %U /data/db)" = mongodb ] || chown -R mongodb /data/db
# Drop root privilege (no way back), exec provided command as user mongodb
cmd=exec; for i; do cmd="$cmd ‘$i‘"; done
exec su -s /bin/sh -c "$cmd" mongodb
buildah build-using-dockerfile --file Dockerfile --build-arg HTTP_PROXY=socks://192.168.128.1:10808
buildah bud -t docker-alpine-mongo:v1 .
sudo podman run -t -i -p 8080:8080 -v /root/trilium-data:/root/trilium-data zadam/trilium:latest
以上是关于docker的主要内容,如果未能解决你的问题,请参考以下文章