1 运行镜像
[[email protected] ~]# docker run -d --name linux85-games jasonyin2020/oldboyedu-games:v0.1
2 创建工作目录
[[email protected] homework]$ mkdir -p /root/dockerfile/homework && cd /root/dockerfile/homework
[[email protected] homework]$ mkdir scripts softwares config dockerfile
3 拷贝源代码
[[email protected] homework]
[[email protected] ~/dockerfile/homework]$ ls softwares/html/
50x.html bird chengbao index.html pingtai pinshu tanke
4 将代码打包
[[email protected] ~/dockerfile/homework]$ for i in {
bird,chengbao,pingtai,pinshu,tanke}; do tar zcf softwares/oldboyedu-${i}.tar.gz -C softwares/html ${i}; done
[[email protected] ~/dockerfile/homework]$ ls softwares/
html oldboyedu-bird.tar.gz oldboyedu-chengbao.tar.gz oldboyedu-pingtai.tar.gz oldboyedu-pinshu.tar.gz oldboyedu-tanke.tar.gz
[[email protected] ~/dockerfile/homework]$ tar tf softwares/oldboyedu-bird.tar.gz
bird/
bird/2000.png
bird/21.js
bird/icon.png
bird/img/
bird/img/bg1.jpg
bird/img/bg2.jpg
bird/img/number1.png
bird/img/number2.png
bird/img/s1.png
bird/img/s2.png
bird/index.html
bird/sound1.mp3
[[email protected] ~/dockerfile/homework]$
[[email protected] homework]$ rm -rf softwares/html/
5 制作配置文件
[[email protected] ~/dockerfile/homework]$ cat > config/bird.conf <<'EOF'
> worker_processes 1;
> events {
> worker_connections 1024;
> }
> http {
> include mime.types;
> default_type application/octet-stream;
> sendfile on;
> keepalive_timeout 65;
>
> server {
> listen 80;