Docker 出错 docker: Error response from daemon: OCI runtime create failed: container_linux.go:348

容器来源于使用官方Dockerfile build的镜像 https://github.com/docker-library/postgres/tree/master/10

环境:CentOS 7

文件列表

-rw-r--r--. 1 root root 3962 Apr  8 17:13 docker-entrypoint.sh
-rw-r--r--. 1 root root 5649 Apr  8 17:13 Dockerfile

build成功后运行,报错:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"docker-entrypoint.sh\": executable file not found in $PATH": unknown.
ERRO[0000] error waiting for container: context canceled 

报错信息为 docker-entrypoint.sh 执行文件找不到,经过一番折腾,发现在build镜像时docker-entrypoint.sh没有执行权限。

解决办法:

1、更改文件权限

# chmod +x docker-entrypoint.sh

2、重新build镜像

# docker build -t postgres:10.3 .

3、运行容器

# docker run postgres:10.3

运行成功

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

 

参考资料:https://stackoverflow.com/questions/27158840/docker-executable-file-not-found-in-path

 

 

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值