操作系统版本:ubuntu 22.04.3 destop
开发环境套件:sudo apt install build-essential
1、删除旧的docker版本:sudo apt-get remove docker docker-engine docker.io containerd runc
2、安装依赖工具:sudo apt-get install ca-certificates curl gnupg lsb-release
3、下载docker源:curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
4、安装docker源:sudo add-apt-repository “deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable”
5、安装docker:apt-get install docker-ce docker-ce-cli containerd.io
6、配置用户组(执行docker命令时不用sudo,可选):sudo usermod -aG docker $USER
7、安装工具:apt-get -y install apt-transport-https ca-certificates curl software-properties-common
8、重启docker:service docker restart
9、验证是否成功:sudo docker run hello-world
1、拉下干净最小的ubuntu:sudo docker pull ubuntu
2、打成公司的标签:sudo docker tag ubuntu zyhdell/ubuntu:v0
3、创建容器:sudo docker run -it --name v1 zyhdell/ubuntu:v0
4、在容器内更新安装源:export DEBIAN_FRONTEND=noninteractive; apt update; apt upgrade
5、在容器内安装:apt install vim ssh make cmake lib32z1-dev
6、退出容器
7、提交成新的镜像:sudo docker commit -m “baseos vim ssh make cmake lib32z1-dev” v1 zyhdell/ubuntu:v1
8、创建测试环境容器:sudo docker run -it --rm -v /opt:/opt --name tt zyhdell/ubuntu:v1
9、在容器内测试:在/opt下测试编译
10、保存镜像成文件:sudo docker save -o zyhdell_ubuntu_v1.tar zyhdell/ubuntu:v1
11、在目标机里载入镜像:sudo docker load < zyhdell_ubuntu_v1.tar
mkdir df_test
cd df_test
vi Dockerfile
#Dockerfile
-----------------------------------------------------------------
FROM ubuntu
MAINTAINER Docker zyhdell <zyhdell@zyhdell.com>
RUN apt-get -qq update
RUN apt-get -qqy upgrade
RUN apt-get -qqy install vim ssh make cmake lib32z1-dev
RUN /bin/echo 'Asia/Shanghai' >/etc/timezone
RUN /bin/echo -e "LANG=\"en_US.UTF-8\"" >/etc/default/local
ENV DEBIAN_FRONTEND noninteractive
---------------------------------------------------------------
sudo docker build -t zyhdell/ubuntu:v1 .
mkdir df_test1
cd df_test1
vi Dockerfile
#Dockerfile
-----------------------------------------------------------------------------
FROM zyhdell/ubuntu:v1
MAINTAINER Docker zyhdell <zyhdell@zyhdell.com>
ENV PATH=/opt/public/gcc/hisi-linux/x86-arm/aarch64-himix200-linux/bin:$PATH
--------------------------------------------------------------------------------
sudo docker build -t my/ubuntu:v1 .
1、创建容器work:sudo docker run -it -d -v /opt:/opt --name work my/ubuntu:v1
-v 把宿主机上的目录共享给容器work使用
2、停止与重启容器:sudo docker [stop start restart] work
3、删除容器:sudo docker rm work
4、进入容器:sudo docker attach work
5、退出容器:退出Ctrl+P+Q,退出并停止exit