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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM