Skip to content

Commit

Permalink
Merge pull request #40 from Zenika-Training/docker-extra-settings
Browse files Browse the repository at this point in the history
Allow to add extra settings for docker
  • Loading branch information
zigarn authored May 2, 2023
2 parents ace08eb + 507f0f9 commit cc857a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 1 addition & 2 deletions scripts/code-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# failfast
set -e

# Define these 3 optional variables if you want to customize the default installation,
# then copy-paste the remainder of the script:
# Define these optional variables if you want to customize the default installation:
# - the version of code-server to install (leave undefined to install the last one)
# code_server_version=3.7.2
# - the port of code-server (default: 9999)
Expand Down
12 changes: 8 additions & 4 deletions scripts/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

# https://docs.docker.com/engine/install/ubuntu/

# Define these optional variables if you want to customize the default installation:
# - the JSON content of daemon.json settings
# docker_extra_settings='{"exec-opts":["native.cgroupdriver=systemd"]}'

# Uninstall old versions
dpkg --purge docker docker-engine docker.io containerd runc
apt-get autoremove --purge -y
apt-get update
apt-get install -y \
jq \
apt-transport-https \
ca-certificates \
curl \
Expand All @@ -24,16 +29,15 @@ apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io

# Enable containers log rotation and compression
cat <<EOF > /etc/docker/daemon.json
{
docker_base_settings='{
"log-driver": "json-file",
"log-opts": {
"max-size": "5k",
"max-file": "3",
"compress": "true"
}
}
EOF
}'
echo "${docker_base_settings}" "${docker_extra_settings:-{\}}" | jq --slurp '.[0] * .[1]' > /etc/docker/daemon.json
systemctl restart docker

# Enable user to use Docker
Expand Down

0 comments on commit cc857a6

Please sign in to comment.