docker安装ubuntu 16.04

2020-03-18  本文已影响0人  小桥流水啦啦啦

1、docker 设置国内镜像源

国内加速地址有:

Docker中国区官方镜像
https://registry.docker-cn.com

网易
http://hub-mirror.c.163.com

ustc
https://docker.mirrors.ustc.edu.cn

中国科技大学
https://docker.mirrors.ustc.edu.cn

阿里云容器 服务
https://cr.console.aliyun.com/
首页点击“创建我的容器镜像” 得到一个专属的镜像加速地址,类似于“https://1234abcd.mirror.aliyuncs.com

2、拉取ubuntu:16.04镜像

PS C:\WINDOWS\system32> docker pull ubuntu:16.04
16.04: Pulling from library/ubuntu
fe703b657a32: Pull complete                                                              f9df1fafd224: Pull complete                                                              a645a4b887f9: Pull complete                                                              57db7fe0b522: Pull complete                                                              Digest: sha256:e9938f45e51d9ff46e2b05a62e0546d0f07489b7f22fbc5288defe760599e38a
Status: Downloaded newer image for ubuntu:16.04
docker.io/library/ubuntu:16.04

PS C:\WINDOWS\system32> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              16.04               77be327e4b63        3 weeks ago         124MB

PS C:\WINDOWS\system32> docker run -it ubuntu:16.04 bash
root@97a9f3813038:/#

root@97a9f3813038:/etc/apt# echo "deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse" >/etc/apt/sources.list

apt-get update
apt-get upgrade

安装必备软件:
apt-get install net-tools inetutils-ping openssh-server samba samba-common git vim

PS C:\WINDOWS\system32> docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES
97a9f3813038        ubuntu:16.04        "bash"              6 minutes ago       Exited (130) 19 seconds ago                       serene_visvesvaraya

PS C:\WINDOWS\system32> docker run -i -t ubuntu:16.04 /bin/bash
root@6b4be1da5af5:/#

root@6b4be1da5af5:/# service ssh start
 * Starting OpenBSD Secure Shell server sshd                                                                                                                                             [ OK ]

3、配置root用户可以登录ssh
找到下面相关配置:

nano /etc/ssh/ssh_config

# Authentication:
LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes

更改为:

# Authentication:
LoginGraceTime 120
#PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes

service ssh restart

4、安装samba


chmod 777 /home
smbpasswd -a root
nano /etc/samba/smb.conf

添加:

[share]
   comment = share folder
   browseable = yes
   path = /home
   create mask = 0700
   directory mask = 0700
   valid users = root
   force user = root
   force group = root
   public = yes
   available = yes
   writable = yes

输入Ctrl + O 保存
输入Ctrl + X 退出
输入service smbd restart

smbpasswd -a root

再设置samba用户root的密码即可。

5、安装repo

apt-get install git 
git config --global user.name "imhqq"
git config --global user.email "88eye88@163.com"
git config --list


mkdir fsl-release-bsp
cd fsl-release-bsp
mkdir .repo
cp -rf ~/bin/repo .repo/

repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-4.1-krogoth --repo-url=https://gerrit-googlesource.lug.ustc.edu.cn/git-repo

6、python 3.5.2 升级到python 3.6

apt-get install software-properties-common
add-apt-repository ppa:jonathonf/python-3.6
apt-get update
apt-get install python3.6
(python升级未成功,待续)
上一篇下一篇

猜你喜欢

热点阅读