I spent almost one week learning some theorems about Docker. And I lost three nights of sleep.
Of course, I learned how to install Docker, pull or export images, write Custom Docker Templates, and even write my own Docker file.
Why did I spend too much to rebuild the system of my server?
Cause I find many problems.
The first problem is it is stupid to back up the whole server. It will deduct the service life of hardware, especially storage devices like USB disks and SD cards. What’s more, this operation takes a long time. I am not patient with that.
The second problem is the environment is hard to work with different OS and hardware. I have to make a great effort to transfer my data into my new machine or OS. Sadly, the new environments always do not work with my old data.
The third problem is different service needs different libs, so I need to install all these packages in the host OS. It works, but if I put all these together, the OS cannot perform well. There are many strange errors that occur and some of these services occupy CPUs and Memory further more than they need. The whole system becomes very slow (including system boot).
The fourth problem is the permissions issue. Different services may need the same folder but different permissions. 777haha, you know what I am saying…
So I tried Docker, to separate these services into different containers. It becomes easy to move data even services into new places. I do not worry about restarting the host operating system when one of these services does not work( just restart the container even rebuild one) and so on.
To minimize the usage of resources by basic service, I installed Raspberry Pi OS Lite this time.
Here is my system.

Here is one example to build my WordPress site.
version: '2'
services:
db:
image: mysql/mysql-server:latest
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: 你猜
MYSQL_DATABASE: wordpress
MYSQL_USER: 啥
MYSQL_PASSWORD: 哦哦
wordpress:
image: wordpress:latest
volumes:
- wordpress_data:/var/www/html
ports:
- 80:80
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: 吼吼
WORDPRESS_DB_PASSWORD: 你好呀
volumes:
db_data:
wordpress_data:
That’s all. Hope I will never reinstall all of these OS and APPs.
Views: 139
