mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-07-10 07:57:37 +00:00
Compare commits
7 Commits
MickLesk-p
...
docker_ref
Author | SHA1 | Date | |
---|---|---|---|
23d5cd197e | |||
8e55a9b0b0 | |||
cbb91adf09 | |||
d596ced793 | |||
4f08b4609b | |||
2e4c185ee1 | |||
64fac95a03 |
@ -16,6 +16,7 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
|
||||
- #### 🐞 Bug Fixes
|
||||
|
||||
- FreshRSS: fix needed php modules [@MickLesk](https://github.com/MickLesk) ([#5886](https://github.com/community-scripts/ProxmoxVE/pull/5886))
|
||||
- core: Fix VAAPI passthrough for unprivileged LXC containers via devX [@MickLesk](https://github.com/MickLesk) ([#5875](https://github.com/community-scripts/ProxmoxVE/pull/5875))
|
||||
- tools.func: fix an bug while php libapache2-mod breaks [@MickLesk](https://github.com/MickLesk) ([#5857](https://github.com/community-scripts/ProxmoxVE/pull/5857))
|
||||
- BabyBuddy: fix path issues for update [@MickLesk](https://github.com/MickLesk) ([#5856](https://github.com/community-scripts/ProxmoxVE/pull/5856))
|
||||
|
76
ct/docker.sh
76
ct/docker.sh
@ -20,18 +20,68 @@ color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /var ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_info "Updating ${APP} LXC"
|
||||
$STD apt-get update
|
||||
$STD apt-get -y upgrade
|
||||
msg_ok "Updated ${APP} LXC"
|
||||
exit
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
get_latest_release() {
|
||||
curl -fsSL https://api.github.com/repos/"$1"/releases/latest | grep '"tag_name":' | cut -d'"' -f4
|
||||
}
|
||||
|
||||
msg_info "Updating base system"
|
||||
$STD apt-get update
|
||||
$STD apt-get -y upgrade
|
||||
msg_ok "Base system updated"
|
||||
|
||||
msg_info "Updating Docker Engine"
|
||||
$STD apt-get install --only-upgrade -y docker-ce docker-ce-cli containerd.io
|
||||
msg_ok "Docker Engine updated"
|
||||
|
||||
if [[ -f /usr/local/lib/docker/cli-plugins/docker-compose ]]; then
|
||||
COMPOSE_BIN="/usr/local/lib/docker/cli-plugins/docker-compose"
|
||||
COMPOSE_NEW_VERSION=$(get_latest_release "docker/compose")
|
||||
msg_info "Updating Docker Compose to $COMPOSE_NEW_VERSION"
|
||||
curl -fsSL "https://github.com/docker/compose/releases/download/${COMPOSE_NEW_VERSION}/docker-compose-$(uname -s)-$(uname -m)" \
|
||||
-o "$COMPOSE_BIN"
|
||||
chmod +x "$COMPOSE_BIN"
|
||||
msg_ok "Docker Compose updated"
|
||||
fi
|
||||
|
||||
if docker ps -a --format '{{.Names}}' | grep -q '^portainer$'; then
|
||||
msg_info "Updating Portainer"
|
||||
docker pull portainer/portainer-ce:latest
|
||||
docker stop portainer && docker rm portainer
|
||||
docker volume create portainer_data >/dev/null 2>&1
|
||||
$STD docker run -d \
|
||||
-p 8000:8000 \
|
||||
-p 9443:9443 \
|
||||
--name=portainer \
|
||||
--restart=always \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v portainer_data:/data \
|
||||
portainer/portainer-ce:latest
|
||||
msg_ok "Updated Portainer"
|
||||
fi
|
||||
|
||||
if docker ps -a --format '{{.Names}}' | grep -q '^portainer_agent$'; then
|
||||
msg_info "Updating Portainer Agent"
|
||||
docker pull portainer/agent:latest
|
||||
docker stop portainer_agent && docker rm portainer_agent
|
||||
$STD docker run -d \
|
||||
-p 9001:9001 \
|
||||
--name=portainer_agent \
|
||||
--restart=always \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /var/lib/docker/volumes:/var/lib/docker/volumes \
|
||||
portainer/agent
|
||||
msg_ok "Updated Portainer Agent"
|
||||
fi
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleanup complete"
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
@ -39,4 +89,4 @@ build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
|
@ -29,7 +29,17 @@ echo -e '{\n "log-driver": "journald"\n}' >/etc/docker/daemon.json
|
||||
$STD sh <(curl -fsSL https://get.docker.com)
|
||||
msg_ok "Installed Docker $DOCKER_LATEST_VERSION"
|
||||
|
||||
read -r -p "${TAB3}Would you like to add Portainer? <y/N> " prompt
|
||||
read -r -p "${TAB3}Install Docker Compose v2 plugin? <y/N> " prompt_compose
|
||||
if [[ ${prompt_compose,,} =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing Docker Compose $DOCKER_COMPOSE_LATEST_VERSION"
|
||||
mkdir -p /usr/local/lib/docker/cli-plugins
|
||||
curl -fsSL "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_LATEST_VERSION}/docker-compose-$(uname -s)-$(uname -m)" \
|
||||
-o /usr/local/lib/docker/cli-plugins/docker-compose
|
||||
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
|
||||
msg_ok "Installed Docker Compose $DOCKER_COMPOSE_LATEST_VERSION"
|
||||
fi
|
||||
|
||||
read -r -p "${TAB3}Would you like to add Portainer (UI)? <y/N> " prompt
|
||||
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing Portainer $PORTAINER_LATEST_VERSION"
|
||||
docker volume create portainer_data >/dev/null
|
||||
@ -43,9 +53,9 @@ if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||
portainer/portainer-ce:latest
|
||||
msg_ok "Installed Portainer $PORTAINER_LATEST_VERSION"
|
||||
else
|
||||
read -r -p "${TAB3}Would you like to add the Portainer Agent? <y/N> " prompt
|
||||
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing Portainer agent $PORTAINER_AGENT_LATEST_VERSION"
|
||||
read -r -p "${TAB3}Would you like to install the Portainer Agent (for remote management)? <y/N> " prompt_agent
|
||||
if [[ ${prompt_agent,,} =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing Portainer Agent $PORTAINER_AGENT_LATEST_VERSION"
|
||||
$STD docker run -d \
|
||||
-p 9001:9001 \
|
||||
--name portainer_agent \
|
||||
@ -57,13 +67,42 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
read -r -p "${TAB3}Would you like to expose the Docker TCP socket? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Exposing Docker TCP socket"
|
||||
$STD mkdir -p /etc/docker
|
||||
$STD echo '{ "hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"] }' > /etc/docker/daemon.json
|
||||
$STD rc-service docker restart
|
||||
msg_ok "Exposed Docker TCP socket at tcp://+:2375"
|
||||
read -r -p "${TAB3}Expose Docker TCP socket (insecure) ? [n = No, l = Local only (127.0.0.1), a = All interfaces (0.0.0.0)] <n/l/a>: " socket_choice
|
||||
case "${socket_choice,,}" in
|
||||
l)
|
||||
socket="tcp://127.0.0.1:2375"
|
||||
;;
|
||||
a)
|
||||
socket="tcp://0.0.0.0:2375"
|
||||
;;
|
||||
*)
|
||||
socket=""
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -n "$socket" ]]; then
|
||||
msg_info "Enabling Docker TCP socket on $socket"
|
||||
$STD apt-get install -y jq
|
||||
|
||||
tmpfile=$(mktemp)
|
||||
jq --arg sock "$socket" '. + { "hosts": ["unix:///var/run/docker.sock", $sock] }' /etc/docker/daemon.json > "$tmpfile" && mv "$tmpfile" /etc/docker/daemon.json
|
||||
|
||||
mkdir -p /etc/systemd/system/docker.service.d
|
||||
cat <<EOF > /etc/systemd/system/docker.service.d/override.conf
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/dockerd
|
||||
EOF
|
||||
|
||||
$STD systemctl daemon-reexec
|
||||
$STD systemctl daemon-reload
|
||||
|
||||
if systemctl restart docker; then
|
||||
msg_ok "Docker TCP socket available on $socket"
|
||||
else
|
||||
msg_error "Docker failed to restart. Check journalctl -xeu docker.service"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
motd_ssh
|
||||
|
@ -13,7 +13,7 @@ setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
PHP_VERSION="8.2" PHP_MODULE="dom,json,ctype,pgsql,gmp,iconv" PHP_APACHE="YES" setup_php
|
||||
PHP_VERSION="8.2" PHP_MODULE="curl,xml,mbstring,intl,zip,pgsql,gmp" PHP_APACHE="YES" setup_php
|
||||
PG_VERSION="16" setup_postgresql
|
||||
|
||||
msg_info "Setting up PostgreSQL"
|
||||
|
Reference in New Issue
Block a user