So rich man wants deploy a server with following characteristics:
Amazon EC2 - t2.2xlarge (expert reviewed)
- vCPU: 8
- MEM: 32GB
The application that he wants it is a variation of cowsay, called dockersay but he needs a change in this app name to trumpsay.
docker run --rm docker/whalesay cowsay hello world
docker run --rm \
-v `pwd`/trump.cow:/cowsay/cows/trump.cow \
docker/whalesay cowsay -f /cowsay/cows/trump.cow "BOOM"
alias trumpsay="docker run --rm \
-v `pwd`/trump.cow:/cowsay/cows/trump.cow \
docker/whalesay cowsay -f /cowsay/cows/trump.cow"
trumpsay BURN FU BURN, BOOM
docker run -it --rm docker/whalesay bash
(pwd && ls -lh)
(cd cows && ls)
cowsay -f turkey.cow aaa
Now lets deploy a meteor app locally
First we need a meteor project app, so lets use this zip file:
Our meteor project runs with node 4.8.1 and mongo 3:2 so we need the next images:
Lets see the Dockerfile for this example
Run this command to create an image:
docker build -t todos:1.0.0 .
Lets run mongo image
docker run -d -p 27017:27017 --restart=always \
--name mongo \
-v `pwd`/database/:/data/db \
mongo:3.2
Lets run node image
docker run -d -p 3000:3000 --restart=always \
--link mongo \
-e MONGO_URL=mongodb://mongo:27017/todos \
--name=app \
todos:1.0.0
Mongo logs
docker logs mongo
Mongo console
docker exec -it mongo bash
So happy man wants to deploy ToDos App in North Korea, the server has the following specifications:
Unknown but same to “EC2 - t1.micro”
- vCPU: 1
- MEM: 0.6GB
They have not a Internet connection, but there is a USB port in the server.
FROM fedora:latest
RUN yum -y install stress && yum clean all
ENTRYPOINT ["stress"]
docker build -t stress .
docker images
docker run -it --rm stress --cpu 4
docker run -it --rm --cpuset-cpus=0 stress --cpu 4
docker run -it --rm --cpuset-cpus=0,2 stress --cpu 4
docker run -it --rm --cpu-period="100000" --cpu-quota="150000" --cpu-cpus=0 stress --cpu 4
docker run -it --rm -m 200m stress --vm 1 --vm-bytes 400M --vm-hang 0
docker ps
docker stats [container_name]
$ docker save [OPTIONS] IMAGE [IMAGE...]
docker save todos:1.0.0 > todos.tar
docker save --output todos_2.tar todos:1.0.0
docker save todos:1.0.0 | bzip2 > todos_3.tar
ls -sh todos.tar
cp todos.tar /path/to/usb/todos.tar
docker rmi todos:1.0.0
docker load < todos.tar
docker load --input todos.tar
docker run -d -p 3000:3000 --restart=always \
--link mongo \
-e MONGO_URL=mongodb://mongo:27017/todos \
--name=app \
todos:1.0.0
So sad man wants to deploy ToDos App in Russia, the server has the following specifications:
Amazon EC2 - t1.micro
- vCPU: 1
- MEM: 0.6GB
They have an good Internet connection, also they want periodical updates.
docker run -d -p 5000:5000 --name registry registry:2
docker tag alpine localhost:5000/myfirstimage
docker push localhost:5000/myfirstimage
docker run -it --rm --net=host centos bash
curl http://localhost:5000/v2/_catalog
docker stop registry && docker rm -v registry
docker run -d -p 5000:5000 --restart=always \
--name registry \
-v `pwd`/data:/var/lib/registry \
registry:2
docker tag todos:1.0.0 localhost:5000/todos:1.0.0
docker push localhost:5000/todos:1.0.0
docker rmi todos:1.0.0
docker pull localhost:5000/todos:1.0.0
docker stop registry && docker rm -v registry