mirror of
https://github.com/phusion/baseimage-docker.git
synced 2026-03-26 12:29:07 +00:00
Merge branch 'next' into patch-2
This commit is contained in:
2
Makefile
2
Makefile
@@ -12,7 +12,7 @@ test:
|
|||||||
env NAME=$(NAME) VERSION=$(VERSION) ./test/runner.sh
|
env NAME=$(NAME) VERSION=$(VERSION) ./test/runner.sh
|
||||||
|
|
||||||
tag_latest:
|
tag_latest:
|
||||||
docker tag -f $(NAME):$(VERSION) $(NAME):latest
|
docker tag $(NAME):$(VERSION) $(NAME):latest
|
||||||
|
|
||||||
release: test tag_latest
|
release: test tag_latest
|
||||||
@if ! docker images $(NAME) | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME) version $(VERSION) is not yet built. Please run 'make build'"; false; fi
|
@if ! docker images $(NAME) | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME) version $(VERSION) is not yet built. Please run 'make build'"; false; fi
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -169,7 +169,8 @@ In `memcached.sh` (make sure this file is chmod +x):
|
|||||||
In `Dockerfile`:
|
In `Dockerfile`:
|
||||||
|
|
||||||
RUN mkdir /etc/service/memcached
|
RUN mkdir /etc/service/memcached
|
||||||
ADD memcached.sh /etc/service/memcached/run
|
COPY memcached.sh /etc/service/memcached/run
|
||||||
|
RUN chmod +x /etc/service/memcached/run
|
||||||
|
|
||||||
Note that the shell script must run the daemon **without letting it daemonize/fork it**. Usually, daemons provide a command line flag or a config file option for that.
|
Note that the shell script must run the daemon **without letting it daemonize/fork it**. Usually, daemons provide a command line flag or a config file option for that.
|
||||||
|
|
||||||
@@ -193,8 +194,8 @@ In `logtime.sh`:
|
|||||||
In `Dockerfile`:
|
In `Dockerfile`:
|
||||||
|
|
||||||
RUN mkdir -p /etc/my_init.d
|
RUN mkdir -p /etc/my_init.d
|
||||||
ADD logtime.sh /etc/my_init.d/logtime.sh
|
COPY logtime.sh /etc/my_init.d/logtime.sh
|
||||||
RUN chmod +x /etc/my_init.d/logtime.sh
|
RUN chmod +x /etc/my_init.d/logtime.sh
|
||||||
|
|
||||||
<a name="environment_variables"></a>
|
<a name="environment_variables"></a>
|
||||||
### Environment variables
|
### Environment variables
|
||||||
@@ -408,6 +409,19 @@ Baseimage-docker disables the SSH server by default. Add the following to your D
|
|||||||
# init system will auto-generate one during boot.
|
# init system will auto-generate one during boot.
|
||||||
RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
|
RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
|
||||||
|
|
||||||
|
Alternatively, to enable sshd only for a single instance of your container, create a folder with a [startup script](#running_startup_scripts). The contents of that should be
|
||||||
|
|
||||||
|
### In myfolder/enable_ssh.sh (make sure this file is chmod +x):
|
||||||
|
#!/bin/sh
|
||||||
|
rm -f /etc/service/sshd/down
|
||||||
|
ssh-keygen -P "" -t dsa -f /etc/ssh/ssh_host_dsa_key
|
||||||
|
|
||||||
|
Then, you can start your container with
|
||||||
|
|
||||||
|
docker run -d -v `pwd`/myfolder:/etc/my_init.d my/dockerimage
|
||||||
|
|
||||||
|
This will initialize sshd on container boot. You can then access it with the insecure key as below, or using the methods to add a secure key. Further, you can publish the port to your machine with -p 22:2222 allowing you to ssh to localhost:2222 instead of looking up the ip address.
|
||||||
|
|
||||||
<a name="ssh_keys"></a>
|
<a name="ssh_keys"></a>
|
||||||
#### About SSH keys
|
#### About SSH keys
|
||||||
|
|
||||||
@@ -459,7 +473,7 @@ Instructions for logging in the container is the same as in section [Using the i
|
|||||||
Edit your Dockerfile to install an SSH public key:
|
Edit your Dockerfile to install an SSH public key:
|
||||||
|
|
||||||
## Install an SSH of your choice.
|
## Install an SSH of your choice.
|
||||||
ADD your_key.pub /tmp/your_key.pub
|
COPY your_key.pub /tmp/your_key.pub
|
||||||
RUN cat /tmp/your_key.pub >> /root/.ssh/authorized_keys && rm -f /tmp/your_key.pub
|
RUN cat /tmp/your_key.pub >> /root/.ssh/authorized_keys && rm -f /tmp/your_key.pub
|
||||||
|
|
||||||
Then rebuild your image. Once you have that, start a container based on that image:
|
Then rebuild your image. Once you have that, start a container based on that image:
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ Baseimage-docker *鼓励* 通过runit来运行多进程.
|
|||||||
|
|
||||||
### 在Dockerfile中:
|
### 在Dockerfile中:
|
||||||
RUN mkdir /etc/service/memcached
|
RUN mkdir /etc/service/memcached
|
||||||
ADD memcached.sh /etc/service/memcached/run
|
COPY memcached.sh /etc/service/memcached/run
|
||||||
|
|
||||||
注意脚本必须运行在后台的,**不能让他们进程进行daemonize/fork**.通常,后台进程会提供一个标志位或者配置文件.
|
注意脚本必须运行在后台的,**不能让他们进程进行daemonize/fork**.通常,后台进程会提供一个标志位或者配置文件.
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ baseimage-docker的初始化脚本 `/sbin/my_init`,在启动的时候进程运
|
|||||||
|
|
||||||
### 在 Dockerfile中:
|
### 在 Dockerfile中:
|
||||||
RUN mkdir -p /etc/my_init.d
|
RUN mkdir -p /etc/my_init.d
|
||||||
ADD logtime.sh /etc/my_init.d/logtime.sh
|
COPY logtime.sh /etc/my_init.d/logtime.sh
|
||||||
|
|
||||||
|
|
||||||
<a name="environment_variables"></a>
|
<a name="environment_variables"></a>
|
||||||
@@ -486,7 +486,7 @@ Baseimage-docker提供了一个灵活的方式运行只要一闪而过的命令,
|
|||||||
编辑你的dockerfile,来安装ssh public key:
|
编辑你的dockerfile,来安装ssh public key:
|
||||||
|
|
||||||
## 安装你自己的public key.
|
## 安装你自己的public key.
|
||||||
ADD your_key.pub /tmp/your_key.pub
|
COPY your_key.pub /tmp/your_key.pub
|
||||||
RUN cat /tmp/your_key.pub >> /root/.ssh/authorized_keys && rm -f /tmp/your_key.pub
|
RUN cat /tmp/your_key.pub >> /root/.ssh/authorized_keys && rm -f /tmp/your_key.pub
|
||||||
|
|
||||||
重新创建你的镜像.一旦你创建成功,启动基于这个镜像的容器.
|
重新创建你的镜像.一旦你创建成功,启动基于这个镜像的容器.
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ The image is called `phusion/baseimage`, and is available on the Docker registry
|
|||||||
|
|
||||||
### 在Dockerfile中:
|
### 在Dockerfile中:
|
||||||
RUN mkdir /etc/service/memcached
|
RUN mkdir /etc/service/memcached
|
||||||
ADD memcached.sh /etc/service/memcached/run
|
COPY memcached.sh /etc/service/memcached/run
|
||||||
|
|
||||||
注意腳本必須運行在後臺的,**不能讓他們行程進行daemonize/fork**.通常,後臺行程會提供一個標誌位或者配置文件.
|
注意腳本必須運行在後臺的,**不能讓他們行程進行daemonize/fork**.通常,後臺行程會提供一個標誌位或者配置文件.
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ baseimage-docker的初始化腳本 `/sbin/my_init`,在啓動的時候行程運
|
|||||||
|
|
||||||
### 在 Dockerfile中:
|
### 在 Dockerfile中:
|
||||||
RUN mkdir -p /etc/my_init.d
|
RUN mkdir -p /etc/my_init.d
|
||||||
ADD logtime.sh /etc/my_init.d/logtime.sh
|
COPY logtime.sh /etc/my_init.d/logtime.sh
|
||||||
|
|
||||||
|
|
||||||
<a name="environment_variables"></a>
|
<a name="environment_variables"></a>
|
||||||
@@ -487,7 +487,7 @@ Baseimage-docker提供了一個靈活的方式運行只要一閃而過的命令,
|
|||||||
編輯你的dockerfile,來安裝ssh public key:
|
編輯你的dockerfile,來安裝ssh public key:
|
||||||
|
|
||||||
## 安裝你自己的public key.
|
## 安裝你自己的public key.
|
||||||
ADD your_key.pub /tmp/your_key.pub
|
COPY your_key.pub /tmp/your_key.pub
|
||||||
RUN cat /tmp/your_key.pub >> /root/.ssh/authorized_keys && rm -f /tmp/your_key.pub
|
RUN cat /tmp/your_key.pub >> /root/.ssh/authorized_keys && rm -f /tmp/your_key.pub
|
||||||
|
|
||||||
重新創建你的鏡像.一旦你創建成功,啓動基於這個鏡像的容器.
|
重新創建你的鏡像.一旦你創建成功,啓動基於這個鏡像的容器.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
FROM ubuntu:16.04
|
FROM ubuntu:16.04
|
||||||
MAINTAINER Phusion <info@phusion.nl>
|
MAINTAINER Phusion <info@phusion.nl>
|
||||||
|
|
||||||
ADD . /bd_build
|
COPY . /bd_build
|
||||||
|
|
||||||
RUN /bd_build/prepare.sh && \
|
RUN /bd_build/prepare.sh && \
|
||||||
/bd_build/system_services.sh && \
|
/bd_build/system_services.sh && \
|
||||||
@@ -9,4 +9,8 @@ RUN /bd_build/prepare.sh && \
|
|||||||
/bd_build/fix_pam_bug.sh && \
|
/bd_build/fix_pam_bug.sh && \
|
||||||
/bd_build/cleanup.sh
|
/bd_build/cleanup.sh
|
||||||
|
|
||||||
|
ENV LANG en_US.UTF-8
|
||||||
|
ENV LANGUAGE en_US:en
|
||||||
|
ENV LC_ALL en_US.UTF-8
|
||||||
|
|
||||||
CMD ["/sbin/my_init"]
|
CMD ["/sbin/my_init"]
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ $minimal_apt_get_install cron
|
|||||||
mkdir /etc/service/cron
|
mkdir /etc/service/cron
|
||||||
chmod 600 /etc/crontab
|
chmod 600 /etc/crontab
|
||||||
cp /bd_build/services/cron/cron.runit /etc/service/cron/run
|
cp /bd_build/services/cron/cron.runit /etc/service/cron/run
|
||||||
|
# Fix cron issues in 0.9.19, see also #345: https://github.com/phusion/baseimage-docker/issues/345
|
||||||
|
sed -i 's/^\s*session\s\+required\s\+pam_loginuid.so/# &/' /etc/pam.d/cron
|
||||||
|
|
||||||
## Remove useless cron entries.
|
## Remove useless cron entries.
|
||||||
# Checks for lost+found and scans for mtab.
|
# Checks for lost+found and scans for mtab.
|
||||||
|
|||||||
36
image/services/syslog-ng/logrotate.conf
Normal file
36
image/services/syslog-ng/logrotate.conf
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# see "man logrotate" for details
|
||||||
|
# rotate log files weekly
|
||||||
|
weekly
|
||||||
|
|
||||||
|
# use the syslog group by default, since this is the owning group
|
||||||
|
# of /var/log/syslog.
|
||||||
|
# su root syslog
|
||||||
|
|
||||||
|
# keep 4 weeks worth of backlogs
|
||||||
|
rotate 4
|
||||||
|
|
||||||
|
# create new (empty) log files after rotating old ones
|
||||||
|
create
|
||||||
|
|
||||||
|
# uncomment this if you want your log files compressed
|
||||||
|
#compress
|
||||||
|
|
||||||
|
# packages drop log rotation information into this directory
|
||||||
|
include /etc/logrotate.d
|
||||||
|
|
||||||
|
# no packages own wtmp, or btmp -- we'll rotate them here
|
||||||
|
/var/log/wtmp {
|
||||||
|
missingok
|
||||||
|
monthly
|
||||||
|
create 0664 root utmp
|
||||||
|
rotate 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/var/log/btmp {
|
||||||
|
missingok
|
||||||
|
monthly
|
||||||
|
create 0660 root utmp
|
||||||
|
rotate 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# system-specific logs may be configured here
|
||||||
@@ -21,4 +21,5 @@ cp $SYSLOG_NG_BUILD_PATH/syslog-forwarder.runit /etc/service/syslog-forwarder/ru
|
|||||||
|
|
||||||
## Install logrotate.
|
## Install logrotate.
|
||||||
$minimal_apt_get_install logrotate
|
$minimal_apt_get_install logrotate
|
||||||
|
cp $SYSLOG_NG_BUILD_PATH/logrotate.conf /etc/logrotate.conf
|
||||||
cp $SYSLOG_NG_BUILD_PATH/logrotate_syslogng /etc/logrotate.d/syslog-ng
|
cp $SYSLOG_NG_BUILD_PATH/logrotate_syslogng /etc/logrotate.d/syslog-ng
|
||||||
|
|||||||
Reference in New Issue
Block a user