Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
docker-image
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tools
docker-image
Commits
400092e4
Commit
400092e4
authored
Aug 11, 2019
by
caiyanming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add zookeeper
Change-Id: I7c45fca36c6705400ac97ee800dc3691e4e50f74
parent
9e8540e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
0 deletions
+109
-0
zookeeper/Dockerfile
zookeeper/Dockerfile
+67
-0
zookeeper/docker-entrypoint.sh
zookeeper/docker-entrypoint.sh
+42
-0
No files found.
zookeeper/Dockerfile
0 → 100644
View file @
400092e4
FROM
registry-vpc.cn-hangzhou.aliyuncs.com/schbrain/jdk:8u172
MAINTAINER
xt
ENV
ZOO_CONF_DIR=/conf \
ZOO_DATA_DIR=/data \
ZOO_DATA_LOG_DIR=/datalog \
ZOO_LOG_DIR=/logs \
ZOO_TICK_TIME=2000 \
ZOO_INIT_LIMIT=5 \
ZOO_SYNC_LIMIT=2 \
ZOO_AUTOPURGE_PURGEINTERVAL=0 \
ZOO_AUTOPURGE_SNAPRETAINCOUNT=3 \
ZOO_MAX_CLIENT_CNXNS=60 \
ZOO_STANDALONE_ENABLED=true \
ZOO_ADMINSERVER_ENABLED=true
# Add a user with an explicit UID/GID and create necessary directories
RUN
set
-eux
;
\
groupadd
-r
zookeeper
--gid
=
1000
;
\
useradd
-r
-g
zookeeper
--uid
=
1000 zookeeper
;
\
mkdir
-p
"
$ZOO_DATA_LOG_DIR
"
"
$ZOO_DATA_DIR
"
"
$ZOO_CONF_DIR
"
"
$ZOO_LOG_DIR
"
;
\
chown
zookeeper:zookeeper
"
$ZOO_DATA_LOG_DIR
"
"
$ZOO_DATA_DIR
"
"
$ZOO_CONF_DIR
"
"
$ZOO_LOG_DIR
"
# Install required packges
RUN
set
-eux
;
\
apt-get update
;
\
DEBIAN_FRONTEND
=
noninteractive
\
apt-get
install
-y
--no-install-recommends
\
ca-certificates
\
dirmngr
\
gosu
\
gnupg
\
netcat
\
wget
;
\
rm
-rf
/var/lib/apt/lists/
*
;
\
# Verify that gosu binary works
gosu nobody true
ARG
GPG_KEY=3F7A1D16FA4217B1DC75E1C9FFE35B7F15DFA1BA
ARG
SHORT_DISTRO_NAME=zookeeper-3.5.5
ARG
DISTRO_NAME=apache-zookeeper-3.5.5-bin
# Download Apache Zookeeper, verify its PGP signature, untar and clean up
RUN
set
-eux
;
\
wget
-q
"https://www.apache.org/dist/zookeeper/
$SHORT_DISTRO_NAME
/
$DISTRO_NAME
.tar.gz"
;
\
wget
-q
"https://www.apache.org/dist/zookeeper/
$SHORT_DISTRO_NAME
/
$DISTRO_NAME
.tar.gz.asc"
;
\
export
GNUPGHOME
=
"
$(
mktemp
-d
)
"
;
\
gpg
--keyserver
ha.pool.sks-keyservers.net
--recv-key
"
$GPG_KEY
"
||
\
gpg
--keyserver
pgp.mit.edu
--recv-keys
"
$GPG_KEY
"
||
\
gpg
--keyserver
keyserver.pgp.com
--recv-keys
"
$GPG_KEY
"
;
\
gpg
--batch
--verify
"
$DISTRO_NAME
.tar.gz.asc"
"
$DISTRO_NAME
.tar.gz"
;
\
tar
-zxf
"
$DISTRO_NAME
.tar.gz"
;
\
mv
"
$DISTRO_NAME
/conf/"
*
"
$ZOO_CONF_DIR
"
;
\
rm
-rf
"
$GNUPGHOME
"
"
$DISTRO_NAME
.tar.gz"
"
$DISTRO_NAME
.tar.gz.asc"
;
\
chown
-R
zookeeper:zookeeper
"/
$DISTRO_NAME
"
WORKDIR
$DISTRO_NAME
VOLUME
["$ZOO_DATA_DIR", "$ZOO_DATA_LOG_DIR", "$ZOO_LOG_DIR"]
EXPOSE
2181 2888 3888 8080
ENV
PATH=$PATH:/$DISTRO_NAME/bin \
ZOOCFGDIR=$ZOO_CONF_DIR
COPY
docker-entrypoint.sh /
ENTRYPOINT
["/docker-entrypoint.sh"]
CMD
["zkServer.sh", "start-foreground"]
zookeeper/docker-entrypoint.sh
0 → 100755
View file @
400092e4
#!/bin/bash
set
-e
# Allow the container to be started with `--user`
if
[[
"
$1
"
=
'zkServer.sh'
&&
"
$(
id
-u
)
"
=
'0'
]]
;
then
chown
-R
zookeeper
"
$ZOO_DATA_DIR
"
"
$ZOO_DATA_LOG_DIR
"
"
$ZOO_LOG_DIR
"
"
$ZOO_CONF_DIR
"
exec
gosu zookeeper
"
$0
"
"
$@
"
fi
# Generate the config only if it doesn't exist
if
[[
!
-f
"
$ZOO_CONF_DIR
/zoo.cfg"
]]
;
then
CONFIG
=
"
$ZOO_CONF_DIR
/zoo.cfg"
echo
"dataDir=
$ZOO_DATA_DIR
"
>>
"
$CONFIG
"
echo
"dataLogDir=
$ZOO_DATA_LOG_DIR
"
>>
"
$CONFIG
"
echo
"tickTime=
$ZOO_TICK_TIME
"
>>
"
$CONFIG
"
echo
"initLimit=
$ZOO_INIT_LIMIT
"
>>
"
$CONFIG
"
echo
"syncLimit=
$ZOO_SYNC_LIMIT
"
>>
"
$CONFIG
"
echo
"autopurge.snapRetainCount=
$ZOO_AUTOPURGE_SNAPRETAINCOUNT
"
>>
"
$CONFIG
"
echo
"autopurge.purgeInterval=
$ZOO_AUTOPURGE_PURGEINTERVAL
"
>>
"
$CONFIG
"
echo
"maxClientCnxns=
$ZOO_MAX_CLIENT_CNXNS
"
>>
"
$CONFIG
"
echo
"standaloneEnabled=
$ZOO_STANDALONE_ENABLED
"
>>
"
$CONFIG
"
echo
"admin.enableServer=
$ZOO_ADMINSERVER_ENABLED
"
>>
"
$CONFIG
"
if
[[
-z
$ZOO_SERVERS
]]
;
then
ZOO_SERVERS
=
"server.1=localhost:2888:3888;2181"
fi
for
server
in
$ZOO_SERVERS
;
do
echo
"
$server
"
>>
"
$CONFIG
"
done
fi
# Write myid only if it doesn't exist
if
[[
!
-f
"
$ZOO_DATA_DIR
/myid"
]]
;
then
echo
"
${
ZOO_MY_ID
:-
1
}
"
>
"
$ZOO_DATA_DIR
/myid"
fi
exec
"
$@
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment