容器初始化

来自linux中国网wiki
跳到导航 跳到搜索

os.init


echo 'deb http://mirrors.163.com/debian/ buster main non-free contrib
deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ buster main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib' >sources.list

#可以看一下别人要安装的是哪些
apt install -y  vim.tiny  curl cron procps #usage vim.tiny  vim太重了 

修改已有官方镜像


利用 Dockerfile 来创建镜像

docker build --tag evan886/centos-nginx:v1 -f nginx/Dockerfile .


docker run --name nginx -p 80:80 -v /data/apps/nginx/html/:/data/apps/nginx/html/ -d  -it 9a4ccef0484d

登入容器:
docker exec -it jenkins /bin/bash


docker push evan886/centos-nginx:v1