其他分享
首页 > 其他分享> > Docker容器创建后问题

Docker容器创建后问题

作者:互联网

1. 通过ssh 连接容器

安装ssh:

Ubuntu安装和配置ssh教程_future_ai的博客-CSDN博客_ubuntu安装ssh

安装之前要看是否更换了apt源,并更新。

cd /etc/apt
echo "
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-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports 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 
" > sources.list

apt-get update

sudo apt-get upgrade  这个命令,会把本地已安装的软件,与刚下载的软件列表里对应软件进行对比,如果发现已安装的软件版本太低,就会提示你更新

update是更新软件列表,upgrade是更新软件。

创建容器时,通过指定端口,例如9001:22,通过主机9001端口,就可ssh登录容器

标签:容器,mirrors,创建,universe,bionic,ubuntu,Docker,multiverse,restricted
来源: https://blog.csdn.net/zhzsdiligence/article/details/120661324