在Docker Alpine容器中启动Shell

编程入门 行业动态 更新时间:2024-10-23 01:34:01
本文介绍了在Docker Alpine容器中启动Shell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

要为Ubuntu映像启动交互式shell,可以运行:

To start an interactive shell for the Ubuntu image we can run:

ole@T:~$ docker run -it --rm ubuntu root@1a6721e1fb64:/# ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var

但是当为 Alpine Docker映像运行时,会产生以下结果:

But when this is run for the Alpine Docker image, the following results:

ole@T:~$ docker run -it --rm alpine Error response from daemon: No command specified

在Alpine基本容器中启动交互式shell的命令是什么?

What is the command for starting an interactive shell in an Alpine base container?

推荐答案

ole@T:~$ docker run -it --rm alpine /bin/ash (inside container) / #

上面使用的选项:

  • /bin/ash是提供的Ash( Almquist Shell )通过BusyBox
  • --rm退出(docker run --help)时自动删除容器
  • -i交互模式(即使未连接也保持STDIN打开)
  • -t分配伪TTY
  • /bin/ash is Ash (Almquist Shell) provided by BusyBox
  • --rm Automatically remove the container when it exits (docker run --help)
  • -i Interactive mode (Keep STDIN open even if not attached)
  • -t Allocate a pseudo-TTY

更多推荐

在Docker Alpine容器中启动Shell

本文发布于:2023-11-17 04:42:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608866.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:容器   Docker   Alpine   Shell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!