Skip to content

Instantly share code, notes, and snippets.

@froop
Last active December 23, 2021 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save froop/3304052725b3f3f2c06a280ea06f8431 to your computer and use it in GitHub Desktop.
Save froop/3304052725b3f3f2c06a280ea06f8431 to your computer and use it in GitHub Desktop.
[Linux] CentOS 7 + Docker
#!/bin/bash -eu
# locale
localectl set-locale LANG=ja_JP.UTF-8
# timezone
echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock
rm -f /etc/localtime
ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
# swap file
dd if=/dev/zero of=/swapfile bs=128M count=8
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile swap swap defaults 0 0' >> /etc/fstab
# docker
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
systemctl enable docker
systemctl start docker
usermod -a -G docker centos
# docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# git
yum install -y git
yum clean all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment