- Fork the https://github.com/szatmari/devops-docker project
- Start a "DevOps - Docker, Kubernetes" in the BME cloud
- Expose ports 80, 8088
- If needed: tune the /etc/resolv.conf and add 8.8.8.8 as nameserver
- Clone the repository to the cloud VM
- Test simple docker command
docker run -it ubuntu
docker run -d ubuntu sleep 100
docker ps
- Test a simple PHP application
mkdir php-project
echo '<?php echo "Hello world!" ?>' >> php-project/index.php
docker run -d -v /home/cloud/php-project:/var/www/html --name myphpcontainer php:7.2-apache
docker inspect myphpcontainer
IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' myphpcontainer)
curl $IP
- Test your gradle project
cd devops-docker
docker run --rm -u gradle -v "$PWD":/home/gradle/project -w /home/gradle/project -p 8088:8088 gradle gradle build
docker run --rm -u gradle -v "$PWD":/home/gradle/project -w /home/gradle/project -p 8088:8088 gradle gradle bootRun
docker run -v "${PWD}/build/libs":/app java java -jar /app/gs-rest-service-0.1.0.jar
Chech the http://cloudip:port/greeting in your browser
- Test multi-container setup
docker run -d -e MYSQL_ROOT_PASSWORD=devops -e MYSQL_DATABASE=golf -v $(pwd)/database:/docker-entrypoint-initdb.d --name=mymysql mysql
IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mymysql)
docker run --rm -u gradle -v "$PWD":/home/gradle/project -w /home/gradle/project -p 8088:8088 -e DBHOST=$IP gradle gradle bootRun
Chech the http://cloudip:port/sql your browser
- Test docker-compose deployment
docker-compose up
- Test basic commands
microk8s.kubectl get nodes -o wide
microk8s.kubectl get all
microk8s.kubectl apply -f kubernetes.yml