docker

win7    官网下载toolbox 

打开 3 图标中的 Docker Quickstart ...

扩展:修改docker镜像提高下载速度

         

             docker-machine ssh default
             sudo sed -i "s|EXTRA_ARGS='|EXTRA_ARGS='--registry-mirror=https://registry.docker-cn.com |g" /var/lib/boot2docker/profile
             exit 
             docker-machine restart default
             docker info

docker run -it --name="容器名字" ubuntu  /bin/bash

附加命令:docker rm "容器名字或id"

                强制删除 docker rm -f "容器名字或id"

                进入 容器 未运行的容器  要加 docker start "名字"

                                   docker attach "名字"

                  查看运行的容器 docker ps

                  查看所有容器 docker ps -a

                  linux常用命令
                  ls  查看目录下的文件
                  ls -a 查看目录下的文件(包含隐藏文件)
                  pwd 列出当前绝对路径
                 mkdir 创建文件夹
                  mkdir -p 创建多个文件夹
                 touch 创建空白文件

 

更新镜像

apt-get update

安装对应工具包

apt-get install -y vim

更换ubuntu镜像为阿里云

打开配置文件

cp /etc/apt/sources.list /etc/apt/sources.list.bak

rm /etc/apt/sources.list

vim /etc/apt/sources.list

写入相关镜像

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

 更新镜像

apt-get update

apt-get install -y wget

apt-get install -y openssh-server

apt-get install -y net-tools

apt-get install -y net-tools       # ifconfig 

apt-get install -y iputils-ping     # ping

apt-get install -y gcc

apt-get install -y make

 

安装python环境

apt-get install -y python3

apt-get install -y python3-pip

apt-get install -y python2.7

apt-get install -y python-pip

测试

python3

pip3 list

python2

pip2 list

 

打包镜像

docker commit -a '提交人名' -m '描述'  镜像名  提交后的名字

 

推送到仓库

docker tag  镜像ID 用户名/镜像名:TAG

docker push 用户名/镜像名

 

posted @ 2018-08-03 20:31  Eunuch_Li  阅读(100)  评论(0编辑  收藏  举报