Last active
May 14, 2020 18:03
-
-
Save chrismessiah/b46926aae7ea0beec2f53bef0f4d2018 to your computer and use it in GitHub Desktop.
Quick demo of docker #fkon2020
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 | |
# add swap | |
SWAP_SIZE=10G | |
fallocate -l $SWAP_SIZE /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
free -h | |
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab | |
# install docker | |
apt-get update | |
apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - | |
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
apt-get update | |
apt-get install -y docker-ce docker-ce-cli containerd.io | |
# prepare socker | |
docker network create --subnet=172.20.0.0/16 mysubnet | |
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.7.0 | |
docker pull docker.elastic.co/kibana/kibana:7.7.0 | |
docker pull httpd:2.4.43 | |
docker pull nginx:1.17.10 | |
docker pull wordpress:5.4.1-php7.4-apache | |
docker pull atlassian/bitbucket-server | |
IP=$(ifconfig eth0 | grep "inet " | awk '{print $2}') | |
URLS="" | |
docker run \ | |
-d \ | |
--restart always \ | |
--net mysubnet \ | |
--name elasticsearch \ | |
-p 9200:9200 \ | |
-e "discovery.type=single-node" \ | |
docker.elastic.co/elasticsearch/elasticsearch:7.7.0 | |
URLS="${URLS} | |
elasticsearch http://$IP:9200" | |
docker run \ | |
-d \ | |
--restart always \ | |
--net mysubnet \ | |
--name kibana \ | |
-p 5601:5601 \ | |
docker.elastic.co/kibana/kibana:7.7.0 | |
URLS="${URLS} | |
kibana http://$IP:5601" | |
docker run \ | |
-d \ | |
--restart always \ | |
--net mysubnet \ | |
--name httpd \ | |
-p 8080:80 \ | |
httpd:2.4.43 | |
URLS="${URLS} | |
httpd http://$IP:8080" | |
docker run \ | |
-d \ | |
--restart always \ | |
--net mysubnet \ | |
--name nginx \ | |
-p 8081:80 \ | |
nginx:1.17.10 | |
URLS="${URLS} | |
nginx http://$IP:8081" | |
docker run \ | |
-d \ | |
--restart always \ | |
--net mysubnet \ | |
--name wordpress \ | |
-p 8082:80 \ | |
wordpress:5.4.1-php7.4-apache | |
URLS="${URLS} | |
wordpress http://$IP:8082" | |
docker run \ | |
-d \ | |
--name bitbucket \ | |
-p 7990:7990 \ | |
atlassian/bitbucket-server | |
URLS="${URLS} | |
bitbucket http://$IP:7990" | |
docker ps | |
echo "$URLS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment