码迷,mamicode.com
首页 > 其他好文 > 详细

docker

时间:2020-04-14 01:05:39      阅读:69      评论:0      收藏:0      [点我收藏+]

标签:centos   systemctl   ||   stop   rhel   ash   nta   odm   epo   


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\nhttps://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

标签:centos   systemctl   ||   stop   rhel   ash   nta   odm   epo   

原文地址:https://www.cnblogs.com/yzpopulation/p/12695152.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!