5-15|Docker报错OCI runtime exec failed: exec failed: unable to start container process: exec: “/bin/ba

简介: 5-15|Docker报错OCI runtime exec failed: exec failed: unable to start container process: exec: “/bin/ba

Docker报错OCI runtime exec failed: exec failed: unable to start container process: exec: “/bin/bash“解决

报错

进入容器时,报如下错误:

[root@iZhp33j6fklnmhbf0lz2obZ admin]# docker exec -it admin_web_1 /bin/bash

OCI runtime exec failed: exec failed: unable to start container process: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown

解决

将 /bin/bash换成 /bin/sh成功

[root@iZhp33j6fklnmhbf0lz2obZ admin]# docker exec -it admin_web_1 /bin/sh

/code # ls

Dockerfile          app.py              bak                 docker-compose.yml  index.html

分析

制作镜像时使用了精简版,只装了sh命令,未安装bash。

如下都是精简版:

redis:alpine FROM

python:3.6-alpine

小拓展

Shell简介

Shell是一种应用程序,这个应用程序提供了一个界面,用户通过这个界面访问操作系统内核的服务。Shell 是一个用 C 语言编写的程序,它是用户使用 Linux 的桥梁。Shell 既是一种命令语言,又是一种程序设计语言。

sh(Bourne Shell)是一个早期的重要shell,1978年由史蒂夫·伯恩编写,并同Version 7 Unix一起发布。

bash(Bourne-Again Shell)是一个为GNU计划编写的Unix shell。1987年由布莱恩·福克斯创造。主要目标是与POSIX标准保持一致,同时兼顾对sh的兼容,是各种Linux发行版标准配置的Shell,在Linux系统上/bin/sh往往是指向/bin/bash的符号链接。

含义:

#! 是一个特殊标记,说明这是一个可执行的脚本。除了第一行,其他以#开头的都不再生效,为注释。

#! 后面是脚本的解释器程序路径。这个程序可以是shell,程序语言或者其他通用程序,常用的是bash、sh。

#!/bin/bash

#!/bin/sh

查看

查看系统可使用的shell类型

cat /etc/shells    

[root@iZhp33j6fklnmhbf0lz2obZ admin]#  cat /etc/shells

/bin/sh

/bin/bash

/usr/bin/sh

/usr/bin/bash

查看当前默认设置,一般在第一行

cat /etc/passwd    

[root@iZhp33j6fklnmhbf0lz2obZ admin]# cat /etc/passwd

root:x:0:0:root:/root:/bin/bash

查看当前sh状态

ll /bin/sh  

查看当前bash状态

ll /bin/bash  

[root@iZhp33j6fklnmhbf0lz2obZ admin]# ll /bin/sh

lrwxrwxrwx. 1 root root 4 Nov  9  2019 /bin/sh -> bash

[root@iZhp33j6fklnmhbf0lz2obZ admin]# ll /bin/bash

-rwxr-xr-x. 1 root root 1219248 Nov  9  2019 /bin/bash


相关文章
|
10月前
|
Ubuntu Linux Shell
(已解决)Linux环境—bash: wget: command not found; Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
(已成功解决)Linux环境报错—bash: wget: command not found;常见Linux发行版本,Linux中yum、rpm、apt-get、wget的区别;Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
4660 69
(已解决)Linux环境—bash: wget: command not found; Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
|
8月前
|
Linux Docker 容器
安装docker-18.06报错Error: libseccomp conflicts with docker-18.06
通过这些步骤,您可以成功在CentOS上安装Docker 18.06,并解决libseccomp的冲突问题。这些方法确保系统兼容性,并保证Docker的正常运行。
213 27
|
12月前
|
JavaScript 前端开发 Docker
拿下奇怪的前端报错(二):nvm不可用报错`GLIBC_2.27‘‘GLIBCXX_3.4.20‘not Found?+ 使用docker构建多个前端项目实践
本文介绍了在多版本Node.js环境中使用nvm进行版本管理和遇到的问题,以及通过Docker化构建流程来解决兼容性问题的方法。文中详细描述了构建Docker镜像、启动临时容器复制构建产物的具体步骤,有效解决了不同项目对Node.js版本的不同需求。
500 1
|
11月前
|
Kubernetes Docker 容器
【赵渝强老师】Docker的Container网络模式
Docker容器在网络环境中彼此隔离,但可通过配置不同网络模式实现容器间通信。其中,container模式使容器共享同一网络命名空间,通过localhost或127.0.0.1互相访问,提高传输效率。本文介绍了container模式的特点及具体示例。
223 0
|
12月前
|
网络虚拟化 Docker 容器
docker Desktop报错 error pulling image configuration 处理
docker Desktop报错 error pulling image configuration 处理
202 0
|
3月前
|
存储 监控 测试技术
如何将现有的应用程序迁移到Docker容器中?
如何将现有的应用程序迁移到Docker容器中?
289 57
|
4月前
|
存储 运维 安全
Docker化运维:容器部署的实践指南
Docker化运维:容器部署的实践指南
|
3月前
|
存储 监控 Java
如何对迁移到Docker容器中的应用进行性能优化?
如何对迁移到Docker容器中的应用进行性能优化?
261 59
|
3月前
|
NoSQL Redis Docker
使用Docker Compose工具进行容器编排的教程
以上就是使用Docker Compose进行容器编排的基础操作。这能帮你更有效地在本地或者在服务器上部署和管理多容器应用。
349 11