docker

关注公众号 jb51net

关闭
首页 > 网站技巧 > 服务器 > 云和虚拟化 > docker > Alpine安装telnet

Alpine镜像中如何安装telnet

作者:morris131

BusyBox是一个在嵌入式系统和资源受限环境中广泛使用的工具集合,它为用户提供了轻量级、功能强大和灵活的命令行工具集,这篇文章主要介绍了Alpine镜像中安装telnet,需要的朋友可以参考下

Alpine镜像是一个基于Alpine Linux发行版构建的Docker镜像,具有以下特点和优势:

Alpine镜像的广泛应用得益于其小巧、安全、易于定制和活跃的社区支持等特点,特别是在容器化应用场景下,它成为了首选的基础镜像。使用Alpine镜像可以带来多个好处,包括镜像下载速度加快,镜像安全性提高,主机之间的切换更方便,占用更少磁盘空间等。

此外,Alpine Linux提供了自己的包管理工具apk,使得用户可以通过apk命令直接查询和安装各种软件。Alpine镜像也适用于更多常用场景,是一个优秀的可以适用于生产的基础系统/环境。

Alpine镜像安装软件

Alpine镜像安装telnet

Alpine镜像中的telnet在3.7版本后被转移至busybox-extras包中:

$ apk update
$ apk add busybox-extras
$telnet smtp.163.com 25   #telnet 确认指定端口是否开启

Alpine镜像安装MySQL客户端

$ apk add --no-cache mysql-client

BusyBox

BusyBox命令工具是一个面向嵌入式系统的工具集合,它提供了一个精简的Unix工具集合,包括了许多常用的命令和工具。

BusyBox的主要特点

BusyBox的常用命令

BusyBox包含了许多常见的Unix命令,其中一些常见的命令包括:

busybox提供的所有命令如下:

$ busybox
BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2015.
Licensed under GPLv2. See source distribution for detailed
copyright notices.
Usage: busybox [function [arguments]...]
   or: busybox --list[-full]
   or: busybox --install [-s] [DIR]
   or: function [arguments]...
        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as.
Currently defined functions:
        [, [[, acpid, add-shell, addgroup, adduser, adjtimex, arch, arp, arping, ash, awk, base64, basename, bbconfig, bc, beep, blkdiscard,
        blkid, blockdev, brctl, bunzip2, bzcat, bzip2, cal, cat, chattr, chgrp, chmod, chown, chpasswd, chroot, chvt, cksum, clear, cmp, comm,
        cp, cpio, crond, crontab, cryptpw, cut, date, dc, dd, deallocvt, delgroup, deluser, depmod, df, diff, dirname, dmesg, dnsdomainname,
        dos2unix, du, dumpkmap, echo, egrep, eject, env, ether-wake, expand, expr, factor, fallocate, false, fatattr, fbset, fbsplash, fdflush,
        fdisk, fgrep, find, findfs, flock, fold, free, fsck, fstrim, fsync, fuser, getopt, getty, grep, groups, gunzip, gzip, halt, hd, head,
        hexdump, hostid, hostname, hwclock, id, ifconfig, ifdown, ifenslave, ifup, init, inotifyd, insmod, install, ionice, iostat, ip, ipaddr,
        ipcalc, ipcrm, ipcs, iplink, ipneigh, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd, last, less, link, linux32,
        linux64, ln, loadfont, loadkmap, logger, login, logread, losetup, ls, lsattr, lsmod, lsof, lsusb, lzcat, lzma, lzop, lzopcat, makemime,
        md5sum, mdev, mesg, microcom, mkdir, mkdosfs, mkfifo, mkfs.vfat, mknod, mkpasswd, mkswap, mktemp, modinfo, modprobe, more, mount,
        mountpoint, mpstat, mv, nameif, nanddump, nandwrite, nbd-client, nc, netstat, nice, nl, nmeter, nohup, nologin, nproc, nsenter,
        nslookup, ntpd, od, openvt, partprobe, passwd, paste, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, pmap, poweroff,
        printenv, printf, ps, pscan, pstree, pwd, pwdx, raidautorun, rdate, rdev, readahead, readlink, realpath, reboot, reformime,
        remove-shell, renice, reset, resize, rev, rfkill, rm, rmdir, rmmod, route, run-parts, sed, sendmail, seq, setconsole, setfont,
        setkeycodes, setlogcons, setpriv, setserial, setsid, sh, sha1sum, sha256sum, sha3sum, sha512sum, showkey, shred, shuf, slattach, sleep,
        sort, split, stat, strings, stty, su, sum, swapoff, swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar, tee, test, time,
        timeout, top, touch, tr, traceroute, traceroute6, tree, true, truncate, tty, ttysize, tunctl, udhcpc, udhcpc6, umount, uname, unexpand,
        uniq, unix2dos, unlink, unlzma, unlzop, unshare, unxz, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock, volname, watch,
        watchdog, wc, wget, which, who, whoami, whois, xargs, xxd, xzcat, yes, zcat, zcip

busybox-extras提供的所有命令如下:

$ busybox-extras
BusyBox v1.36.1 (2024-06-12 06:28:12 UTC) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2015.
Licensed under GPLv2. See source distribution for detailed
copyright notices.
Usage: busybox [function [arguments]...]
   or: busybox --list[-full]
   or: busybox --install [-s] [DIR]
   or: function [arguments]...
        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as.
Currently defined functions:
        arch, conspy, dnsd, dumpleases, fakeidentd, ftpd, ftpget, ftpput, httpd, inetd, readahead, tcpsvd, telnet, telnetd, tftp, tftpd,
        udhcpd

BusyBox的优缺点

优点:轻量级、功能强大、灵活性和兼容性好。
缺点:由于BusyBox的设计目标是提供一个精简的工具集,因此某些高级功能可能不支持;对于不熟悉BusyBox的用户来说,可能需要一些时间来适应其命令行接口和工具的使用方式。

总的来说,BusyBox是一个在嵌入式系统和资源受限环境中广泛使用的工具集合,它为用户提供了轻量级、功能强大和灵活的命令行工具集。

补充:Alpine安装telnet、curl等命令

镜像加速:

sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories

apk库更新:

apk update

安装curl:

apk add curl

安装telnet

apk add busybox-extras

到此这篇关于Alpine镜像中安装telnet的文章就介绍到这了,更多相关Alpine安装telnet内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

您可能感兴趣的文章:
阅读全文