如何将couchdb服务器添加到docker创建文件中 [英] How to add couchdb server into docker creation file

查看:256
本文介绍了如何将couchdb服务器添加到docker创建文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的码头文件:

I have a docker file like this :

FROM ubuntu:12.04
MAINTAINER me <me@c.com>

RUN apt-get -y update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install supervisor \
apache2 \
mysql-server \
php5 \
libapache2-mod-php5 \
php5-mysql \
php5-mcrypt

#ssh
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:root' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile

EXPOSE 22 80
ADD ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord"]

我的问题是如何在这个docker文件中添加一个couchdb服务器?

My question is how do I add a couchdb server into this docker file?

我可以从这里获得一个内置的couchdb docker映像: https://hub.docker.com/r/klaemo/couchdb/ ,但是如何创建像我这样的图像?我找不到有关流程的任何文件!

I can get a built-in couchdb docker image from here : https://hub.docker.com/r/klaemo/couchdb/, but how do I create a image like this my self? I can't find any documentation regarding the process!

我花了3个小时尝试google,但没有运气,所以我会冒险,即使这是一个转储问题!

I spent 3 hours tried to googled but got no luck, so I will take the risk to ask even if this is a dump question!

推荐答案

您的Docker容器中是否有特定版本的couchdb?
如果没有,由于您使用的是Ubuntu 12.04作为基础映像,您可以从 couchdb 添加到您的 apt-get rel =nofollow noreferrer c $ c>列表如下:

Is there a specific version of couchdb that you want in your docker container? If not, since you are using Ubuntu 12.04 as your base image, you can get the couchdb 1.0.1 binaries from the Ubuntu 12.04/precise [universe] repository easily by adding couchdb to your apt-get list like this:

FROM ubuntu:12.04
MAINTAINER me <me@c.com>

RUN apt-get -y update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install supervisor \
apache2 \
mysql-server \
php5 \
libapache2-mod-php5 \
php5-mysql \
php5-mcrypt \
couchdb
#[--Rest of your dockerfile goes here unchanged--]

您也可以使用 PPA 由Apache CouchDB团队维护,以获得基于正式发布的焦油球的基本图像的最新稳定版本。对于此选项,您可以使用以下docker文件:

You can alternatively use the PPA maintained by the Apache CouchDB team to get latest stable releases for your base image based on the officially released tar balls. For this option you can use the following dockerfile:

# To install the ppa finder tool in your docker container
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python-software-properties
RUN add-apt-repository ppa:couchdb/stable -y
RUN apt-get -y update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install supervisor \
apache2 \
mysql-server \
php5 \
libapache2-mod-php5 \
php5-mysql \
php5-mcrypt \
couchdb
#[--Rest of your dockerfile goes here unchanged--]

如果您想要在docker容器中使用最新或特定版本的couchdb,那么您可能需要从源代码中构建couchdb。请注意,这种方法将需要您安装更多的软件包( g ++ erlang-dev erlang-manpages erlang-base-hipe erlang-eunit,libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool )到您的容器,以便能够从源代码构建couchdb。但是,您可以清除/删除仅构建couchdb所需的包。完整的依赖性列表可以在 apache上的官方couchdb构建wiki 中找到。如果你真的想要最新的版本,那么你可以参考这个 dockerfile 并相应地添加更新您的dockerfile。这是一个完整的docker文件[UNTESTED],方便您使用:

If you want the latest or a specific version of couchdb in your docker container then you might have to build couchdb from the source code. Note that this approach will require you to install many more packages (g++ erlang-dev erlang-manpages erlang-base-hipe erlang-eunit, libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool) onto your container to be able to build couchdb from source. However you may be able to purge/remove the packages that are required only to build couchdb. The complete list of dependencies can be found on the official couchdb build wiki on apache. If you really want THE latest version then you can refer to this dockerfile and add update your dockerfile accordingly. Here is a complete dockerfile [UNTESTED] for your ease of use:

FROM ubuntu:12.04
MAINTAINER me <me@c.com>
ENV COUCHDB_VERSION master
RUN groupadd -r couchdb && useradd -d /usr/src/couchdb -g couchdb couchdb
# download dependencies 
RUN apt-get update -y -qq && apt-get install -y --no-install-recommends \
build-essential \
erlang-dev \
erlang-manpages \
erlang-base-hipe \
erlang-eunit \
erlang-nox \
erlang-xmerl \
erlang-inets \
libmozjs185-dev \
libicu-dev \
libcurl4-gnutls-dev \
libtool
RUN cd /usr/src && git clone https://git-wip-us.apache.org/repos/asf/couchdb.git \ 
&& cd couchdb && git checkout $COUCHDB_VERSION \ 
&& cd /usr/src/couchdb && ./configure && make
# You can optionally purge/remove the packages you installed to build the couchdb from source.
# permissions
RUN chmod +x /usr/src/couchdb/dev/run && chown -R couchdb:couchdb /usr/src/couchdb
USER couchdb 
EXPOSE 5984 15984 25984 35984 15986 25986 35986
#[--Rest of your dockerfile can go here as required--]

这篇关于如何将couchdb服务器添加到docker创建文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆