Last active
April 27, 2022 05:11
-
-
Save serenitii/af69b966244efcc806747af9f016d9e6 to your computer and use it in GitHub Desktop.
ubuntu_20.04_mariadb_docker.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ubuntu Server 2020.04 | |
# 서버 시간 한국으로 설정 | |
date | |
sudo ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime | |
date | |
# First add the required dependencies and the security key: | |
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common | |
# Add Docker’s official GPG key: | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
# Make sure that the key fingerprint is 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88: | |
sudo apt-key fingerprint 0EBFCD88 | |
# Add the Docker repository corresponding to your CPU architecture and Operating System version (arch=arm64): | |
sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
sudo apt-get update | |
sudo apt-get -y install docker-ce | |
sudo docker -v | |
# Add your user to docker group: | |
sudo usermod -aG docker ${USER} | |
# root password on ec2 | |
sudo passwd | |
# Docker sudo 없이 실행하기 | |
# sudo usermod -aG docker ${USER} | |
# su - ${USER} | |
# mariadb 실행 | |
docker run --name mariadb -d -p 3306:3306 --restart=always -e MYSQL_ROOT_PASSWORD="Dbdb9999((" mariadb | |
# redis 실행 | |
docker run --name myredis -d -p 6379:6379 --restart=always redis | |
# nginx on ubuntu 실행 | |
docker container run --name webserver -d -p 80:80 --restart=always ubuntu/nginx | |
# docker exec -it ba7a7c478b74 /bin/bash | |
# portainer | |
# docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce | |
# docker expose remote api | |
# https://scriptcrunch.com/enable-docker-remote-api | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment