一聚教程网:一个值得你收藏的教程网站

热门教程

ubuntu中docker 命令行下的虚拟机安装步骤

时间:2022-06-30 19:22:40 编辑:袖梨 来源:一聚教程网


ubuntu下安装
sudo apt-get  install docker.io
# start docker
service docker.io status
service docker.io start
报错 Error loading docker apparmor profile: exec: "/sbin/apparmor_parser": stat /sbin/apparmor_parser: no such file or directory ()
apt-get install apparmor # 安装 apparmor
docker -d # no error happens
service docker.io start # 启动成功
docker info # 看到一堆信息
sudo docker run ubuntu /bin/echo hello world
# 直接开始pull ubuntu的镜像,pull好执行输出 hello world
docker run -i -t ubuntu /bin/bash # 交互方式 cli
进入交互模式之后安装些工具,些个脚本在当前container里面
apt-get update
apt-get install nodejs
# add a nodejs shell
docker ps -a # get the container id
docker export 9e840e23be03 > image.tgz #输出镜像
cat image.tgz | sudo docker import - ubuntu_with_nodejs # 导入镜像
docker images # list all the images
docker run -i -t ubuntu_with_nodejs /bin/bash  # 进入这个自定义的镜像之后之前的功能都有,命令也在之内

热门栏目