1.创建并分配22端口【3316外部、22镜像的22端口】安装宝塔用第二个
docker run --name iubuntu -t -i -d -p 3316:22 ubuntu
#docker run --name testbt -t -i -d -p 3022:22-p 3020:20 -p 3021:21 -p 3080:80 -p 30443:443 -p 3887:888 -p 3888:8888 docker/mybuuntu
2.进入linux
docker exec -t -i iubuntu /bin/bash
3.跟新原
apt-get update
安装 openssh-client 后输入 Y
apt-get install openssh-client
5.安装 apt-get install openssh-server 后输入 Y
apt-get install openssh-server
Please select the geographic area in which you live. Subsequent configuration questions will narrow this down by
presenting a list of cities, representing the time zones in which they are located.
1. Africa 3. Antarctica 5. Arctic 7. Atlantic 9. Indian 11. SystemV 13. Etc
2. America 4. Australia 6. Asia 8. Europe 10. Pacific 12. US
Geographic area: 6
Please select the city or region corresponding to your time zone.
1. Aden 16. Brunei 31. Hong_Kong 46. Kuala_Lumpur 61. Pyongyang 76. Tehran
2. Almaty 17. Chita 32. Hovd 47. Kuching 62. Qatar 77. Tel_Aviv
3. Amman 18. Choibalsan 33. Irkutsk 48. Kuwait 63. Qostanay 78. Thimphu
4. Anadyr 19. Chongqing 34. Istanbul 49. Macau 64. Qyzylorda 79. Tokyo
5. Aqtau 20. Colombo 35. Jakarta 50. Magadan 65. Rangoon 80. Tomsk
6. Aqtobe 21. Damascus 36. Jayapura 51. Makassar 66. Riyadh 81. Ujung_Pandang
7. Ashgabat 22. Dhaka 37. Jerusalem 52. Manila 67. Sakhalin 82. Ulaanbaatar
8. Atyrau 23. Dili 38. Kabul 53. Muscat 68. Samarkand 83. Urumqi
9. Baghdad 24. Dubai 39. Kamchatka 54. Nicosia 69. Seoul 84. Ust-Nera
10. Bahrain 25. Dushanbe 40. Karachi 55. Novokuznetsk 70. Shanghai 85. Vientiane
11. Baku 26. Famagusta 41. Kashgar 56. Novosibirsk 71. Singapore 86. Vladivostok
12. Bangkok 27. Gaza 42. Kathmandu 57. Omsk 72. Srednekolymsk 87. Yakutsk
13. Barnaul 28. Harbin 43. Khandyga 58. Oral 73. Taipei 88. Yangon
14. Beirut 29. Hebron 44. Kolkata 59. Phnom_Penh 74. Tashkent 89. Yekaterinburg
15. Bishkek 30. Ho_Chi_Minh 45. Krasnoyarsk 60. Pontianak 75. Tbilisi 90. Yerevan
Time zone: 31
6.启动ssh
/etc/init.d/ssh start
7.查看ssh
ps -e|grep ssh
8.安装 vim
apt-get install vim
9.修改ssh配置 PermitRootLogin yes
vim /etc/ssh/sshd_config
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
10.重启ssh
service ssh restart
11.设置服务器密码
passwd root
root@3df95d076f27:/# passwd root
New password:
Retype new password:
12.安装 net-tools
apt-get install net-tools
13.查看网卡信息
ifconfig
exit
14.生成新的镜像
docker commit 3df95d076f27 docker/mybuuntu
如果关闭过容器需要重新打开 ssh服务
docker exec -t -i 3df95d076f27 /bin/bash
service ssh restart
安装宝塔
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
Bt-Panel: http://113.109.111.48:8888/83956573
username: ffbicmd8
password: 0252337e
Warning:
If you cannot access the panel,
release the following port (8888|888|80|443|20|21) in the security group
查看对应的8888映射端口
PS C:\Users\zy\Desktop> docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
617d812890a2 docker/mybuuntu "/bin/bash" 10 minutes ago Up 10 minutes 0.0.0.0:3020->20/tcp, 0.0.0.0:3021->21/tcp, 0.0.0.0:3022->22/tcp, 0.0.0.0:3080->80/tcp, 0.0.0.0:3043->443/tcp, 0.0.0.0:3887->888/tcp, 0.0.0.0:3888->8888/tcp testbt
3df95d076f27 ubuntu "/bin/bash" 23 hours ago Exited (0) 19 hours ago iubuntu
0da3fc4f906d ubuntu "/bin/bash" 23 hours ago Exited (0) 23 hours ago dazzling_hermann
b613cdfc97d1 ubuntu "/bin/bash" 23 hours ago Exited (130) 23 hours ago ubuntu-test
daf8c30327e3 ubuntu:15.10 "/bin/sh -c 'while t…" 23 hours ago Exited (137) 23 hours ago busy_ritchie
17e30218035f ubuntu:15.10 "/bin/sh" 23 hours ago Exited (0) 23 hours ago loving_leakey
8cee2b54195c ubuntu:15.10 "/bin/echo 'Hello wo…" 23 hours ago Exited (0) 23 hours ago pedantic_chebyshev
访问
http://127.0.0.1:3888/83956573/