Refactor Couchbase 2.5 Docker setup and scripts

Updated Dockerfile to add libssl0.9.8, split some RUN commands, and improved permissions handling. Modified entrypoint.sh to use 'set -ex' for better debugging and switched to 'runsvdir -P /etc/service' for process management. Cleaned up docker-compose.example.yml by commenting out unused options. Updated run script to unset HOME before execution for improved environment consistency.
This commit is contained in:
2025-10-05 22:30:23 +07:00
parent 035484e5cf
commit a9d0d65fa4
4 changed files with 19 additions and 10 deletions
+9 -5
View File
@@ -19,7 +19,10 @@ RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://old-releases.ubuntu.com/u
# numactl: numactl
RUN apt-get update && \
apt-get install -yq runit wget python-httplib2 chrpath tzdata \
lsof lshw sysstat net-tools numactl librtmp0 dos2unix && \
lsof lshw sysstat net-tools numactl librtmp0 \
libssl0.9.8 \
dos2unix \
&& \
apt-get autoremove && apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@@ -43,15 +46,15 @@ RUN export INSTALL_DONT_START_SERVER=1 && \
# Add runit script for couchbase-server
COPY scripts/run /etc/service/couchbase-server/run
RUN dos2unix /etc/service/couchbase-server/run && \
chmod +x /etc/service/couchbase-server/run && \
chown -R couchbase:couchbase /etc/service
chmod +x /etc/service/couchbase-server/run
RUN chown -R couchbase:couchbase /etc/service
# Add dummy script for commands invoked by cbcollect_info that
# make no sense in a Docker container
COPY scripts/dummy.sh /usr/local/bin/
RUN dos2unix /usr/local/bin/dummy.sh && \
chmod +x /usr/local/bin/dummy.sh && \
ln -s dummy.sh /usr/local/bin/iptables-save && \
chmod +x /usr/local/bin/dummy.sh
RUN ln -s dummy.sh /usr/local/bin/iptables-save && \
ln -s dummy.sh /usr/local/bin/lvdisplay && \
ln -s dummy.sh /usr/local/bin/vgdisplay && \
ln -s dummy.sh /usr/local/bin/pvdisplay
@@ -65,6 +68,7 @@ RUN dos2unix /entrypoint.sh && \
chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["couchbase-server"]
# CMD ["runsvdir", "-P", "/etc/service"]
# 8091: Couchbase Web console, REST/HTTP interface
# 8092: Views, queries, XDCR
+3 -3
View File
@@ -1,14 +1,14 @@
services:
couchbase:
image: ghcr.io/tiennm99/docker-images/couchbase-2.5:latest
# image: couchbase-2.5:latest
ports:
- "8091:8091"
- "8092:8092"
- "11210:11210"
- "11211:11211"
restart: unless-stopped
stdin_open: true
tty: true
# stdin_open: true
# tty: true
volumes:
- couchbase_data:/opt/couchbase/var
+5 -2
View File
@@ -1,10 +1,11 @@
#!/bin/bash
set -e
set -ex
staticConfigFile=/opt/couchbase/etc/couchbase/static_config
restPortValue=8091
# see https://developer.couchbase.com/documentation/server/current/install/install-ports.html
# https://docs.couchbase.com/couchbase-manual-2.5/cb-install/#network-ports
function overridePort() {
portName=$1
portNameUpper=$(echo $portName | awk '{print toupper($0)}')
@@ -39,6 +40,7 @@ overridePort "ssl_proxy_downstream_port"
overridePort "ssl_proxy_upstream_port"
# if [ "$1" == "couchbase-server" ] && [ ! -d "/etc/service" ]; then
[[ "$1" == "couchbase-server" ]] && {
if [ "$(whoami)" = "couchbase" ]; then
@@ -53,7 +55,8 @@ overridePort "ssl_proxy_upstream_port"
fi
echo "Starting Couchbase Server -- Web UI available at http://<ip>:$restPortValue"
echo "and logs available in /opt/couchbase/var/lib/couchbase/logs"
exec /usr/sbin/runsvdir-start
exec /usr/sbin/runsvdir -P /etc/service
}
# fi
exec "$@"
+2
View File
@@ -1,5 +1,7 @@
#!/bin/sh
unset HOME
exec 2>&1
# Create directories where couchbase stores its data