码迷,mamicode.com
首页 > 其他好文 > 详细

为镜像添加SSH服务

时间:2020-01-28 19:22:46      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:back   ssh   logs   ali   安装   html   记录   mirrors   问题   

一、基于commit命令创建

1.1 下载镜像

$docker pull ubuntu:18.04
$docker run -it ubuntu:18.04 bash

1.2 更新软件源

root@b1c8b932403e:/# apt-get update

1.3 添加国内源

root@b1c8b932403e:/# vi /etc/apt/sources.list.d/aliyun.list
#添加如下内容
deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
root@b1c8b932403e:/# apt-get update

添加路由

Route add -net 192.168.0.0/24 gw 192.168.0.1

Route add -host 192.168.0.1 dev 192.168.0.1

删除路由

Route del -net 192.168.0.0/24 gw 192.168.0.1

查看容器IP

 docker inspect mycentos2
docker inspect --format=‘{{.NetworkSettings.IPAddress}}‘ mycentos2

docker启动报错

删除/etc/docker/daemon.json文件

https://www.cnblogs.com/cocowool/p/docker_daemon_log_driver.html


碰到点问题,先记录一下,待会在整理


1.4 安装配置SSH服务

为镜像添加SSH服务

标签:back   ssh   logs   ali   安装   html   记录   mirrors   问题   

原文地址:https://www.cnblogs.com/tz90/p/12238459.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!