alpine安装sshd/ssh server
1、下载alpine镜像
|
1
2
3
4
5
6
7
8
9
10
|
[root@docker43 ~]# docker pull alpineUsing default tag: latestTrying to pull repository docker.io/library/alpine ...latest: Pulling from docker.io/library/alpine4fe2ade4980c: Pull completeDigest: sha256:621c2f39f8133acb8e64023a94dbdf0d5ca81896102b9e57c0dc184cadaf5528Status: Downloaded newer image for docker.io/alpine:latest[root@docker43 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdocker.io/alpine latest 196d12cf6ab1 3 weeks ago 4.41 MB |
2、编写dockerfile
2.1.创建一个工作目录
|
1
2
3
4
5
6
|
[root@docker43 ~]# cd /opt/[root@docker43 opt]# mkdir alpine_ssh && cd alpine_ssh && touch Dockerfile[root@docker43 alpine_ssh]# ll总用量 4-rw-r--r-- 1 root root 654 10月 3 23:21 Dockerfile |
2.2.编写Dockerfile
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# 指定创建的基础镜像FROM alpine# 作者描述信息MAINTAINER alpine_sshd (zhujingzhi@123.com)# 替换阿里云的源RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositoriesRUN echo "http://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories# 同步时间# 更新源、安装openssh 并修改配置文件和生成key 并且同步时间RUN apk update && \ apk add --no-cache openssh tzdata && \ cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config && \ ssh-keygen -t dsa -P "" -f /etc/ssh/ssh_host_dsa_key && \
ssh-keygen -t rsa -P "" -f /etc/ssh/ssh_host_rsa_key && \ ssh-keygen -t ecdsa -P "" -f /etc/ssh/ssh_host_ecdsa_key && \ ssh-keygen -t ed25519 -P "" -f /etc/ssh/ssh_host_ed25519_key && \ echo "root:admin" | chpasswd# 开放22端口EXPOSE 22# 执行ssh启动命令CMD ["/usr/sbin/sshd", "-D"] |
2.3.创建镜像
|
1
2
3
4
|
# 在dockerfile所在的目录下[root@docker43 alpine_ssh]# pwd/opt/alpine_ssh[root@docker43 alpine_ssh]# docker build -t alpine:sshd . |
alpine安装sshd/ssh server的更多相关文章
- 嵌入式Linux安装Dropbear SSH server
0. 背景 OpenSSH因为其相对较大,一般不太适用于嵌入式平台,多用于PC或者服务器的Linux版本中. Dropbear是一个相对较小的SSH服务器和客户端.它运行在一个基于POSIX的各种平台 ...
- Centos更换yum源,安装ssh server
先连上网,然后更换yum源 1. 新建的用户没有sudo权限,所以首先切换到root用户su -输入密码 2. 备份之前的yum源mv /etc/yum.repos.d/CentOS-Base.rep ...
- Alpine容器安装运行ssh
写在前面 本文介绍了在Alpine容器(docker)上安装运行ssh并保证外界(宿主机)能通过ssh登录的方法,给出了相应的命令.在下在探索过程中借鉴了许多前人的经验,在此先行谢过,所有参考内容都会 ...
- Home Assistant 安装Samba和SSH server 插件
安装 Samba 插件 Samba 是 SMB/CIFS 网络协议的重新实现, 它作为 NFS 的补充使得在 Linux 和 Windows 系统中进行文件共享.打印机共享更容易实现. Smaba 服 ...
- Ubuntu 安装 SSH server 并配置 SSH 无密码登录
https://hinine.com/install-and-configure-ssh-server-on-ubuntu/ Ubuntu 安装 SSH server 并配置 SSH 无密码登录 发表 ...
- 在Windows2003安装配置Bitvise SSH Server后,不能使用软件内建立的用户登录!
Google: I can only log in with an administrator account - attempting to log in with a regular accou ...
- Ubuntu配置ssh server
SSH-Server配置指南 一.SSH简介 SSH (Secure Shell)是一个应用程序中提供安全通信的协议,通过SSH协议可以安全地访问服务器,因为SSH 具有成熟的公钥加密体系,在数据进行 ...
- 在fedora 20下使用ssh server
在红帽和centos下,一般安装完后会自带ssh,然后可以通过/etc/init.d/sshd start的方式运行,但是在Fedora 20下,系统改用了另外一套服务开启机制. 首先安装ssh se ...
- Xshell 连接虚拟机出现 "The remote SSH server rejected X11 forwarding request"
1. 描述 虚拟机:VirtualBox Linux: centOS7 解决了 centOS7在VirtualBox中装好后的网络连接问题 后,用 Xshell 连接服务器时出现下面情况: 2. ss ...
随机推荐
- java基础类型的byte为长度
java基础类型的字节长度: 类型 byte数/位数 最大/最小值 byte 1/8 127/-128 short 2/16 32767/-32768 int 4/32 2147483647/-214 ...
- Django框架(二十一)--Django rest_framework-频率组件
一.作用 为了控制用户对某个url请求的频率,比如,一分钟以内,只能访问三次 二.自定义频率类 # 写一个频率认证类 class MyThrottle: visit_dic = {} visit_ti ...
- apache配置项
环境:apache2.24 apache 官方文档:http://httpd.apache.org/docs/2.4/ 全部指令索引: http://httpd.apache.org/docs/ ...
- win10上安装ubunt18双系统过程中出现mmx64.efi not found问题
安装Ubuntu18过程中,从u盘启动ubunt安装,出现mmx64.efi not found问题 如下图: 制作好ubunt启动盘之后在EFI/BOOT下会看到两个文件,将其中grubx64.ef ...
- 如何在Etherscan.io 部署ETH以太坊智能合约 如何在15分钟内创建你的加密货币
一.概述 ETH 网络这里就不介绍了,这篇文章主要记录在以太坊主网和测试网络部署一个智能合约,也就是如何发币. 二.部署合约需要的生产工具 准备工具前,建议大家准备个VPN,因为会访问国外网 ...
- Ninja——小而快的构建系统
介绍 Ninja 是Google的一名程序员推出的注重速度的构建工具,一般在Unix/Linux上的程序通过make/makefile来构建编译,而Ninja通过将编译任务并行组织,大大提高了构建速度 ...
- JMockit学习笔记
一.在eclipse下建立JMockit工程 1.下载最新版JMockit(jmockit-1.4.zip): 2.解压后的文件夹包含有:library jars, source files, sam ...
- Linux性能优化实战学习笔记:第二十一讲
一 内存性能指标 1.系统内存使用情况 共享内存:是通过tmpfs实现的,所以它的大小也就是tmpfs使用的大小了tmpfs其实也是一种特殊的缓存 可用内存:是新进程可以使用的最大内存它包括剩余内存和 ...
- [LeetCode] 894. All Possible Full Binary Trees 所有可能的满二叉树
A full binary tree is a binary tree where each node has exactly 0 or 2 children. Return a list of al ...
- [LeetCode] 116. Populating Next Right Pointers in Each Node 每个节点的右向指针
You are given a perfect binary tree where all leaves are on the same level, and every parent has two ...