master
Logan 2024-07-22 10:11:33 -04:00
parent 8a204467fa
commit 990561b3c0
2 changed files with 22 additions and 6 deletions

View File

@ -1,5 +1,4 @@
#!/bin/bash
#
# 定义日志文件路径
LOG_FILE="/var/log/docker_install.log"
@ -47,9 +46,9 @@ function install_docker() {
local install_method="$1"
if [ "$install_method" == "local" ]; then
if [ -f "docker-24.0.6.tar.gz" ]; then
if [ -f docker-*.tar.gz ]; then
logger "info" "信息:发现本地压缩包,进行解压安装"
tar zxvf docker-24.0.6.tar.gz
tar zxvf docker-*.tar.gz
mv docker/docker.service /etc/systemd/system/docker.service
cp docker/* /usr/bin
else
@ -61,7 +60,7 @@ function install_docker() {
curl -fsSL https://get.docker.com | sh
elif [ "$install_method" == "yum" ]; then
logger "warning" "警告:尝试通过 Yum 安装 Docker"
sudo yum remove docker \
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
@ -70,11 +69,11 @@ function install_docker() {
docker-logrotate \
docker-engine -y
sudo yum-config-manager \
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce -y
yum install docker-ce -y
else
logger "error" "错误:无效的安装方法"
return 1

17
2.docker/ldap.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
password=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 12`
docker run \
-d -p 389:389 -p 636:636 \
--name ldap-service \
--restart=always \
--hostname openldap \
-v /opt/docker-data/slapd/database:/var/lib/ldap \
--volume /opt/docker-data/slapd/config:/etc/ldap/slapd.d \
--env LDAP_ORGANISATION="astralsec.com" \
--env LDAP_DOMAIN="astralsec.com" \
--env LDAP_BASE_DN="dc=astralsec,dc=com" \
--env LDAP_ADMIN_PASSWORD=$password \
osixia/openldap:latest
echo "passwod: $password" > openldap.txt