Exec init exec format error home assistant

На чтение 2 мин Опубликовано 06.04.2020

На чтение 2 мин Опубликовано 06.04.2020

крипты работали очень хорошо, когда я выполнял их напрямую,  например «./script.sh» и «sh script.sh».

Но они не работали, когда я запускал их командой run-parts.

Для тех, кто интересуется, команда run-parts запускает все скрипты в каталоге.

Если вы получили такую ошибку при запуске скрипта, этот быстрый совет поможет вам исправить ошибку «Exec format error» при запуске скриптов с командой run-parts на Linux.

Решение ошибки «Exec format» при запуске скриптов командой run-parts

Чтобы запустить все скрипты в папке «Documents», я запустил:

$ run-parts --regex '^s.*.sh$' Documents

Я получил следующее сообщение об ошибке:

run-parts: failed to exec Documents/script1.sh: Exec format error
run-parts: Documents/script1.sh exited with return code 1
run-parts: failed to exec Documents/script2.sh: Exec format error
run-parts: Documents/script2.sh exited with return code 1
run-parts: failed to exec Documents/script3.sh: Exec format error
run-parts: Documents/script3.sh exited with return code 1
run-parts: failed to exec Documents/script4.sh: Exec format error
run-parts: Documents/script4.sh exited with return code 1

Чтобы исправить «ошибку формата Exec», вам нужно добавить шебанг в начале ваших скриптов, чтобы ядро знало, как их запускать.

Для тех, кому интересно, шебанг – это последовательность символов, состоящая из знака числа символов и восклицательного знака (#!) в начале скрипта.

Когда вы добавляете shebang в начале текстового файла, он интерпретируется как исполняемый файл.

Большинство скриптов начинается с шебанга.

Вот несколько типичных примеров Шебанга:

Bourne shell, или совместимый шеллl:

#!/bin/sh

Bash:

Perl:

Python 2.x:

Python 3.x:

#!/usr/bin/python3

Это то, что мы называем шебанг.

Теперь вернемся к теме.

Отредактируйте ваши скрипты, используя ваш любимый редактор:

$ nano Documents/itsecforu.sh

Добавьте шебанг в начале скрипта:

#!/bin/sh

Теперь вы можете без проблем запускать скрипты с помощью команды run-parts, используя команду run-parts.

Вы также можете использовать утилиту ShellCheck для поиска проблем в своих скриптах оболочки.

Пожалуйста, не спамьте и никого не оскорбляйте.

Это поле для комментариев, а не спамбокс.

Рекламные ссылки не индексируются!

Receiving a Docker exec format error when you run the Docker? We can help you fix it. 

The Docker exec format error is a common error, and we fix the error by adding shebang in the entrypoint of the script.

At Bobcares, we get requests to fix docker exec format error, as a part of our Server Management Services.

Today, let’s have a look at how our Support Engineers fix this error.

Explore more about Docker

The docker container which allows OS level virtualization and is also known as containerization. The main benefits of the docker is to package applications in container and the container is portable to Linux or Windows operating system.

Docker container is a software stores up code and all its dependencies. So that the application runs fast and consistently good in quality and performance.

But, many times Docker container will end up with exec format error. Let’s see how our Support Engineers fix it.

Why does Docker show exec format error?

We see the below docker error when we launch the docker container.

Docker exec format error

Whenever our customers have such an error, our Support Engineers check the entrypoint in the Docker file.

A Docker file is the text document that use all the commands that a user could call on the command line to assemble an image.Also in Docker file we can write the instructions to build a Docker image.

The sign of this error is that the docker entrypoint script was missing a shebang. So to fix the error we add the shebang in the script.

How we fix the exec format error?

We fix this docker error by adding the shebang on the entrypoint of the script. The shebang is a special character sequence in a script file that specifies which program should be called to run the script.

The shebang is always on the first line of the script, and is composed of #! Characters. So the Shebang (#!/bin/bash) should be put on the first line of the script because the first bytes were checked by kernel. So we add the shebang in the script.

#!/bin/bash

The other method to fix the docker error is that we have to run the below command.

$ docker run -entrypoint="/bin/bash" -i test

This fixes the docker error.

[Need help in fixing Docker format error? – We’ll help you.]

Conclusion

In short, The Docker error occurs due to missing of the shebang in the script. The default entrypoint does not know how to run the script. Today, we saw how our Support Engineers fix this error for our customers by adding the shebang at the entrypoint of the script.

Are you using Docker based apps?

There are proven ways to get even more out of your Docker containers! Let us help you.

Spend your time in growing business and we will take care of Docker Infrastructure for you.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

chatofking

Posts: 55
Joined: Sat Apr 30, 2022 5:30 am

exec /usr/local/bin/docker-entrypoint.sh: exec format error

i cannot run docker-compose
when i
sudo docker-compose -f stack.yml up
ERROR: no matching manifest for linux/arm64/v8 in the manifest list entries
i add
platform: linux/x86_64
in my compose
https://hub.docker.com/_/ghost/
then i sudo docker-compose -f stack.yml up again
it shows

Code: Select all

Pulling db (mysql:8.0)...
8.0: Pulling from library/mysql
c1ad9731b2c7: Pull complete
54f6eb0ee84d: Pull complete
cffcf8691bc5: Pull complete
89a783b5ac8a: Pull complete
6a8393c7be5f: Pull complete
af768d0b181e: Pull complete
810d6aaaf54a: Pull complete
2e014a8ae4c9: Pull complete
a821425a3341: Pull complete
3a10c2652132: Pull complete
4419638feac4: Pull complete
681aeed97dfe: Pull complete
Digest: sha256:548da4c67fd8a71908f17c308b8ddb098acf5191d3d7694e56801c6a8b2072cc
Status: Downloaded newer image for mysql:8.0
Creating ghost_db_1    ... done
Creating ghost_ghost_1 ... done
Attaching to ghost_db_1, ghost_ghost_1
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
ghost_db_1 exited with code 1
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
ghost_1  | [2022-06-13 01:51:45] INFO Ghost is running in production...
ghost_1  | [2022-06-13 01:51:45] INFO Your site is now available on http://local                                                                              host:8080/
ghost_1  | [2022-06-13 01:51:45] INFO Ctrl+C to shut down
ghost_1  | [2022-06-13 01:51:46] INFO Ghost server started in 16.763s
ghost_db_1 exited with code 1
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
ghost_1  | [2022-06-13 01:51:53] ERROR connect EHOSTUNREACH 172.18.0.2:3306
ghost_1  |
ghost_1  | connect EHOSTUNREACH 172.18.0.2:3306
ghost_1  |
ghost_1  | "Unknown database error"
ghost_1  |
ghost_1  | Error ID:
ghost_1  |     500
ghost_1  |
ghost_1  | Error Code:
ghost_1  |     EHOSTUNREACH
ghost_1  |
ghost_1  | ----------------------------------------
ghost_1  |
ghost_1  | DatabaseError: connect EHOSTUNREACH 172.18.0.2:3306
ghost_1  |     at DatabaseStateManager.getState (/var/lib/ghost/versions/4.48.1/                                                                              core/server/data/db/state-manager.js:64:32)
ghost_1  |     at DatabaseError.KnexMigrateError (/var/lib/ghost/versions/4.48.1                                                                              /node_modules/knex-migrator/lib/errors.js:7:26)
ghost_1  |     at new DatabaseError (/var/lib/ghost/versions/4.48.1/node_modules                                                                              /knex-migrator/lib/errors.js:55:26)
ghost_1  |     at /var/lib/ghost/versions/4.48.1/node_modules/knex-migrator/lib/                                                                              database.js:57:19
ghost_1  |     at processTicksAndRejections (internal/process/task_queues.js:95:                                                                              5)
ghost_1  |     at async DatabaseStateManager.getState (/var/lib/ghost/versions/4                                                                              .48.1/core/server/data/db/state-manager.js:40:13)
ghost_1  |     at async DatabaseStateManager.makeReady (/var/lib/ghost/versions/                                                                              4.48.1/core/server/data/db/state-manager.js:73:25)
ghost_1  |     at async initDatabase (/var/lib/ghost/versions/4.48.1/core/boot.j                                                                              s:69:5)
ghost_1  |     at async bootGhost (/var/lib/ghost/versions/4.48.1/core/boot.js:4                                                                              14:9)
ghost_1  |
ghost_1  | Error: connect EHOSTUNREACH 172.18.0.2:3306
ghost_1  |     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16)
ghost_1  |
ghost_1  | [2022-06-13 01:51:53] WARN Ghost is shutting down
ghost_1  | [2022-06-13 01:51:53] WARN Ghost has shut down
ghost_1  | [2022-06-13 01:51:53] WARN Your site is now offline
ghost_1  | [2022-06-13 01:51:53] WARN Ghost was running for a few seconds
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
db_1     | exec /usr/local/bin/docker-entrypoint.sh: exec format error
ghost_db_1 exited with code 1

what should i do ??


epoch1970

Posts: 8292
Joined: Thu May 05, 2016 9:33 am
Location: France

Re: exec /usr/local/bin/docker-entrypoint.sh: exec format error

Mon Jun 13, 2022 9:27 am

Don’t change the platform. Only containers built for the native platform can run on a host.
If you run raspios on a Pi 3 or Pi4 that’s arm32v7 docker builds. If you run raspios 64 bits, that’s arm64v8.
The best is to let Docker figure out which platform it runs on. Then it will download the right builds, assuming they are available.

Only use a PC to run images built for Intel’s x86 architecture.

The docker hub page for Ghost starts with links where to get support for Ghost
https://hub.docker.com/_/ghost/?tab=description

I, for one, have no idea what ghost is.

«S’il n’y a pas de solution, c’est qu’il n’y a pas de problème.» Les Shadoks, J. Rouxel


chatofking

Posts: 55
Joined: Sat Apr 30, 2022 5:30 am

Re: exec /usr/local/bin/docker-entrypoint.sh: exec format error

Tue Jun 14, 2022 12:24 am

epoch1970 wrote: ↑

Mon Jun 13, 2022 9:27 am


Don’t change the platform. Only containers built for the native platform can run on a host.
If you run raspios on a Pi 3 or Pi4 that’s arm32v7 docker builds. If you run raspios 64 bits, that’s arm64v8.
The best is to let Docker figure out which platform it runs on. Then it will download the right builds, assuming they are available.

Only use a PC to run images built for Intel’s x86 architecture.

The docker hub page for Ghost starts with links where to get support for Ghost
https://hub.docker.com/_/ghost/?tab=description

I, for one, have no idea what ghost is.

i can’t conntect http://localhost:8080/
ERR_CONNECTION_REFUSED
now i got this
message

Code: Select all

Creating ghost_ghost_1 ... done
Creating ghost_db_1    ... done
Attaching to ghost_ghost_1, ghost_db_1
db_1     | 2022-06-14 00:49:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.29-1.el8 started.
db_1     | 2022-06-14 00:49:14+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1     | 2022-06-14 00:49:15+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.29-1.el8 started.
db_1     | 2022-06-14 00:49:15+00:00 [Note] [Entrypoint]: Initializing database files
db_1     | 2022-06-14T00:49:15.934221Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.29) initializing of server in progress as process 42
db_1     | 2022-06-14T00:49:16.142073Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
db_1     | 2022-06-14T00:49:36.342908Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
ghost_1  | [2022-06-14 00:49:54] INFO Ghost is running in production...
ghost_1  | [2022-06-14 00:49:54] INFO Your site is now available on http://localhost:8080/
ghost_1  | [2022-06-14 00:49:54] INFO Ctrl+C to shut down
ghost_1  | [2022-06-14 00:49:55] INFO Ghost server started in 39.917s
ghost_1  | [2022-06-14 00:50:06] ERROR connect ECONNREFUSED 172.18.0.3:3306
ghost_1  |
ghost_1  | connect ECONNREFUSED 172.18.0.3:3306
ghost_1  |
ghost_1  | "Unknown database error"
ghost_1  |
ghost_1  | Error ID:
ghost_1  |     500
ghost_1  |
ghost_1  | Error Code:
ghost_1  |     ECONNREFUSED
ghost_1  |
ghost_1  | ----------------------------------------
ghost_1  |
ghost_1  | Error: connect ECONNREFUSED 172.18.0.3:3306
ghost_1  |     at /var/lib/ghost/versions/5.2.2/node_modules/knex-migrator/lib/database.js:57:19
ghost_1  |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
ghost_1  |
ghost_1  | [2022-06-14 00:50:06] WARN Ghost is shutting down
ghost_1  | [2022-06-14 00:50:07] WARN Ghost has shut down
ghost_1  | [2022-06-14 00:50:07] WARN Your site is now offline
ghost_1  | [2022-06-14 00:50:07] WARN Ghost was running for a minute
db_1     | 2022-06-14T00:50:07.451587Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
ghost_1  | [2022-06-14 00:51:22] INFO Ghost is running in production...
ghost_1  | [2022-06-14 00:51:22] INFO Your site is now available on http://localhost:8080/
ghost_1  | [2022-06-14 00:51:22] INFO Ctrl+C to shut down
ghost_1  | [2022-06-14 00:51:22] INFO Ghost server started in 18.583s
ghost_1  | [2022-06-14 00:51:27] ERROR connect ECONNREFUSED 172.18.0.3:3306
ghost_1  |
ghost_1  | connect ECONNREFUSED 172.18.0.3:3306
ghost_1  |
ghost_1  | "Unknown database error"
ghost_1  |
ghost_1  | Error ID:
ghost_1  |     500
ghost_1  |
ghost_1  | Error Code:
ghost_1  |     ECONNREFUSED
ghost_1  |
ghost_1  | ----------------------------------------
ghost_1  |
ghost_1  | Error: connect ECONNREFUSED 172.18.0.3:3306
ghost_1  |     at /var/lib/ghost/versions/5.2.2/node_modules/knex-migrator/lib/database.js:57:19
ghost_1  |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
ghost_1  |
ghost_1  | [2022-06-14 00:51:27] WARN Ghost is shutting down
ghost_1  | [2022-06-14 00:51:27] WARN Ghost has shut down
ghost_1  | [2022-06-14 00:51:27] WARN Your site is now offline
ghost_1  | [2022-06-14 00:51:27] WARN Ghost was running for a few seconds
db_1     | 2022-06-14 00:51:32+00:00 [Note] [Entrypoint]: Database files initialized
db_1     | 2022-06-14 00:51:32+00:00 [Note] [Entrypoint]: Starting temporary server
db_1     | 2022-06-14T00:51:48.048144Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 91
db_1     | 2022-06-14T00:51:52.628785Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
db_1     | 2022-06-14T00:52:04.784869Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
ghost_ghost_1 exited with code 2
db_1     | 2022-06-14T00:52:16.687001Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1     | 2022-06-14T00:52:16.687706Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
db_1     | 2022-06-14T00:52:17.862792Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
db_1     | 2022-06-14T00:52:17.870309Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.29'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server - GPL.
db_1     | 2022-06-14 00:52:23+00:00 [Note] [Entrypoint]: Temporary server started.
db_1     | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
db_1     | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
db_1     | Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
db_1     | Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
db_1     | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
db_1     | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
ghost_1  | [2022-06-14 00:53:32] INFO Ghost is running in production...
ghost_1  | [2022-06-14 00:53:32] INFO Your site is now available on http://localhost:8080/
ghost_1  | [2022-06-14 00:53:32] INFO Ctrl+C to shut down
ghost_1  | [2022-06-14 00:53:33] INFO Ghost server started in 30.766s
db_1     |
db_1     | 2022-06-14 00:53:38+00:00 [Note] [Entrypoint]: Stopping temporary server
db_1     | 2022-06-14T00:53:39.285948Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.29).
ghost_1  | [2022-06-14 00:53:40] ERROR connect ECONNREFUSED 172.18.0.3:3306
ghost_1  |
ghost_1  | connect ECONNREFUSED 172.18.0.3:3306
ghost_1  |
ghost_1  | "Unknown database error"
ghost_1  |
ghost_1  | Error ID:
ghost_1  |     500
ghost_1  |
ghost_1  | Error Code:
ghost_1  |     ECONNREFUSED
ghost_1  |
ghost_1  | ----------------------------------------
ghost_1  |
ghost_1  | Error: connect ECONNREFUSED 172.18.0.3:3306
ghost_1  |     at /var/lib/ghost/versions/5.2.2/node_modules/knex-migrator/lib/database.js:57:19
ghost_1  |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
ghost_1  |
ghost_1  | [2022-06-14 00:53:40] WARN Ghost is shutting down
ghost_1  | [2022-06-14 00:53:40] WARN Ghost has shut down
ghost_1  | [2022-06-14 00:53:40] WARN Your site is now offline
ghost_1  | [2022-06-14 00:53:40] WARN Ghost was running for a few seconds
ghost_ghost_1 exited with code 2
db_1     | 2022-06-14T00:54:16.243878Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.29)  MySQL Community Server - GPL.
db_1     | 2022-06-14 00:54:17+00:00 [Note] [Entrypoint]: Temporary server stopped
db_1     |
db_1     | 2022-06-14 00:54:17+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
db_1     |
db_1     | 2022-06-14T00:54:32.706160Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 1
db_1     | 2022-06-14T00:54:38.337262Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
db_1     | 2022-06-14T00:54:49.866382Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
db_1     | 2022-06-14T00:55:00.959447Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1     | 2022-06-14T00:55:00.984270Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
db_1     | 2022-06-14T00:55:03.508530Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
db_1     | 2022-06-14T00:55:03.511792Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.29'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
ghost_1  | [2022-06-14 00:55:13] INFO Ghost is running in production...
ghost_1  | [2022-06-14 00:55:13] INFO Your site is now available on http://localhost:8080/
ghost_1  | [2022-06-14 00:55:13] INFO Ctrl+C to shut down
ghost_1  | [2022-06-14 00:55:13] INFO Ghost server started in 59.753s
ghost_1  | [2022-06-14 00:55:17] WARN Database state requires initialisation.
ghost_1  | [2022-06-14 00:55:32] INFO Creating table: newsletters
ghost_1  | [2022-06-14 00:55:34] INFO Creating table: posts
ghost_1  | [2022-06-14 00:55:36] INFO Creating table: posts_meta
ghost_1  | [2022-06-14 00:55:38] INFO Creating table: users
ghost_1  | [2022-06-14 00:55:39] INFO Creating table: posts_authors
ghost_1  | [2022-06-14 00:55:42] INFO Creating table: roles
ghost_1  | [2022-06-14 00:55:42] INFO Creating table: roles_users
ghost_1  | [2022-06-14 00:55:42] INFO Creating table: permissions
ghost_1  | [2022-06-14 00:55:44] INFO Creating table: permissions_users
ghost_1  | [2022-06-14 00:55:44] INFO Creating table: permissions_roles
ghost_1  | [2022-06-14 00:55:44] INFO Creating table: settings
ghost_1  | [2022-06-14 00:55:45] INFO Creating table: tags
ghost_1  | [2022-06-14 00:55:45] INFO Creating table: posts_tags
ghost_1  | [2022-06-14 00:55:47] INFO Creating table: invites
ghost_1  | [2022-06-14 00:55:49] INFO Creating table: brute
ghost_1  | [2022-06-14 00:55:50] INFO Creating table: sessions
ghost_1  | [2022-06-14 00:55:53] INFO Creating table: integrations
ghost_1  | [2022-06-14 00:55:54] INFO Creating table: webhooks
ghost_1  | [2022-06-14 00:55:55] INFO Creating table: api_keys
ghost_1  | [2022-06-14 00:55:55] INFO Creating table: mobiledoc_revisions
ghost_1  | [2022-06-14 00:55:56] INFO Creating table: members
ghost_1  | [2022-06-14 00:55:56] INFO Creating table: products
ghost_1  | [2022-06-14 00:55:57] INFO Creating table: offers
ghost_1  | [2022-06-14 00:55:59] INFO Creating table: benefits
ghost_1  | [2022-06-14 00:56:00] INFO Creating table: products_benefits
ghost_1  | [2022-06-14 00:56:01] INFO Creating table: members_products
ghost_1  | [2022-06-14 00:56:02] INFO Creating table: posts_products
ghost_1  | [2022-06-14 00:56:03] INFO Creating table: members_cancel_events
ghost_1  | [2022-06-14 00:56:04] INFO Creating table: members_payment_events
ghost_1  | [2022-06-14 00:56:06] INFO Creating table: members_login_events
ghost_1  | [2022-06-14 00:56:07] INFO Creating table: members_email_change_event                                                                              s
ghost_1  | [2022-06-14 00:56:08] INFO Creating table: members_status_events
ghost_1  | [2022-06-14 00:56:11] INFO Creating table: members_product_events
ghost_1  | [2022-06-14 00:56:14] INFO Creating table: members_paid_subscription_events
ghost_1  | [2022-06-14 00:56:15] INFO Creating table: labels
ghost_1  | [2022-06-14 00:56:15] INFO Creating table: members_labels
ghost_1  | [2022-06-14 00:56:18] INFO Creating table: members_stripe_customers
ghost_1  | [2022-06-14 00:56:19] INFO Creating table: members_stripe_customers_subscriptions
ghost_1  | [2022-06-14 00:56:23] INFO Creating table: offer_redemptions
ghost_1  | [2022-06-14 00:56:25] INFO Creating table: members_subscribe_events
ghost_1  | [2022-06-14 00:56:29] INFO Creating table: stripe_products
ghost_1  | [2022-06-14 00:56:29] INFO Creating table: stripe_prices
ghost_1  | [2022-06-14 00:56:30] INFO Creating table: actions
ghost_1  | [2022-06-14 00:56:30] INFO Creating table: emails
ghost_1  | [2022-06-14 00:56:31] INFO Creating table: email_batches
ghost_1  | [2022-06-14 00:56:32] INFO Creating table: email_recipients
ghost_1  | [2022-06-14 00:56:34] INFO Creating table: tokens
ghost_1  | [2022-06-14 00:56:35] INFO Creating table: snippets
ghost_1  | [2022-06-14 00:56:36] INFO Creating table: custom_theme_settings
ghost_1  | [2022-06-14 00:56:36] INFO Creating table: members_newsletters
ghost_1  | [2022-06-14 00:56:43] INFO Model: Product
ghost_1  | [2022-06-14 00:56:44] INFO Model: Newsletter
ghost_1  | [2022-06-14 00:56:44] INFO Model: Tag
ghost_1  | [2022-06-14 00:56:44] INFO Model: Permission
ghost_1  | [2022-06-14 00:56:48] INFO Model: Post
ghost_1  | [2022-06-14 00:56:59] INFO Model: Integration
ghost_1  | [2022-06-14 00:56:59] INFO Relation: Role to Permission
ghost_1  | [2022-06-14 00:57:03] INFO Relation: Post to Tag
ghost_1  | [2022-06-14 00:57:07] INFO Database is in a ready state.
ghost_1  | Ignoring invalid configuration option passed to Connection: filename. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
ghost_1  | [2022-06-14 00:57:07] INFO Ghost database ready in 174.014s
ghost_1  | Ignoring invalid configuration option passed to Connection: filename. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
ghost_1  | Ignoring invalid configuration option passed to Connection: filename. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
ghost_1  | Ignoring invalid configuration option passed to Connection: filename. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
ghost_1  | Ignoring invalid configuration option passed to Connection: filename. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
ghost_1  | Ignoring invalid configuration option passed to Connection: filename. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
ghost_1  | [2022-06-14 00:57:53] INFO Ghost URL Service Ready in 219.398s
ghost_1  | [2022-06-14 00:57:58] INFO Stripe not configured - skipping migrations
ghost_1  | Ignoring invalid configuration option passed to Connection: filename. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
ghost_1  | [2022-06-14 00:57:59] INFO Ghost booted in 225.64s
ghost_1  | [2022-06-14 00:57:59] INFO Adding offloaded job to the queue
ghost_1  | [2022-06-14 00:58:00] INFO Scheduling job update-check at 31 32 16 * * *. Next run on: Tue Jun 14 2022 16:32:31 GMT+0000 (Coordinated Universal Time)

what should i do ??

Last edited by chatofking on Tue Jun 14, 2022 12:58 am, edited 1 time in total.


chatofking

Posts: 55
Joined: Sat Apr 30, 2022 5:30 am

Re: exec /usr/local/bin/docker-entrypoint.sh: exec format error

Tue Jun 14, 2022 12:29 am

here is mine docker-compose settings

Code: Select all

# by default, the Ghost image will use SQLite (and thus requires no separate database container)
# we have used MySQL here merely for demonstration purposes (especially environment-variable-based configuration)

version: '3.1'

services:

  ghost:
    image: ghost:5-alpine
    restart: always
    ports:
      - 8080:2368
    environment:
      # see https://ghost.org/docs/config/#configuration-options
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: example
      database__connection__database: ghost
      # this url value is just an example, and is likely wrong for your environment!
      url: http://localhost:8080
      # contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly>
      #NODE_ENV: development

  db:
    image: mysql:8.0-oracle
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example

Last edited by chatofking on Tue Jun 14, 2022 2:04 am, edited 1 time in total.




cleverca22

Posts: 7007
Joined: Sat Aug 18, 2012 2:33 pm

Re: exec /usr/local/bin/docker-entrypoint.sh: exec format error

Tue Jun 14, 2022 7:41 am

i can reproduce a similar error

Code: Select all

pi@pi400:~/test1 $ sudo docker-compose pull
Pulling ghost ... done
Pulling db    ...

ERROR: for db  no matching manifest for unknown in the manifest list entries
ERROR: no matching manifest for unknown in the manifest list entries
pi@pi400:~/test1 $ 

but in my case, i think its complaining that there is no arm version of mysql, not sure why


Return to “General discussion”

standard_init_linux go 228 exec user process caused exec format error

Docker throws error standard_init_linux.go:228: exec user process caused: exec format error when there are issues with executable file format. It could happen due to these reasons –

  1. You forgot to put #!/bin/bash at the top of shell files.
  2. There is a space before shebang (#!/bin/bash).
  3. Newline character encoding is wrong (LF/CRLF)
  4. Using #!/bin/bash instead of #!/bin/ash for alpine images.
  5. Architecture mismatch like running x86 image on ARM systems.
  6. Script encoding issue – UTF8 + BOM

Error due to #!/bin/bash

There are few things regarding shebang.

  1. There should not be anything before it. Shebang should be the first text in the shell file. Check for spaces, empty lines, hidden characters etc. before it.
  2. Always include it in the shell files. This proves that the file is executable.
  3. Use the right command. If it’s a bash file, use #!/bin/bash, if shell file then use #!/bin/sh and if alpine image then #!/bin/ash.
  4. Don’t forget #. People use to forget it.

Character Encoding (LF/CRLF)

Character encoding is an underdog which creates a number of issues in coding. This happens due to new line styles of various operating systems. For example –

  • Windows uses CRLF (Carriage Return Line Feed). It’s new line is rn.
  • Linux uses LF (Line Feed). It’s new line is n.

When you create codes on Windows, the files uses CRLF encoding. After you deploy them on Linux container it creates encoding issues.

Sometimes this creates standard_init_linux.go:228: exec user process caused: exec format error. So, it’s a good practice to change encoding preferences in your code editors like vscode and notepad++ to LF on Windows.

changing character encoding (CR/LF/CRLF)

Architecture Mismatch (x86 / ARM)

This is the most common issue of exec format error. Take care of these points –

  1. Apple M1 is not of same architecture as of Apple Intel chip. Apple M1 has AMD64 architecture while intel is ARM.
  2. See if you are running 32bit or 64bit operating system.
  3. You can’t build image on ARM and run on AMD64.

Solution is to use buildx utility of Docker –

# Build for ARM64 
docker buildx build --platform=linux/arm64 -t <image-name>:<version>-arm64 .

# Build for AMD64
docker buildx build --platform=linux/amd64 -t <image-name>:<version>-amd64 .

Script encoding (UTF8 + BOM)

Script encoding also seems to be causing issues. Especially on windows systems. So, you will need to check if your executable file is saved as UTF8 or UTF8+BOM. BOM stands for Byte Order Mark. Generally, UTF8 files works fine.

Conclusion

The above mentioned solutions will surely resolve your error of standard_init_linux.go:228: exec user process caused: exec format. First look for ARM or x86 architecture issue. Check if the image is build for your Docker architecture. Then, if the issue persists, check the shebang. If still it’s not solved, then go with other solutions here.

Kubernetes Series
  1. Introduction to Kubernetes
  2. Introduction to Docker, Containers, Images & Repository
  3. Install and Run Docker Images
  4. Docker Image – FROM, RUN, COPY, ENTRYPOINT, CMD, EXPOSE explained
  5. Why docker run or start command not running my container?
  6. How to list all docker images in system?
  7. How to list all docker containers?
  8. How to start/stop a docker container?
  9. Difference between docker run and docker start
  10. How to bind docker container port with host?
  11. How to get logs of docker container?
  12. How to live stream logs of docker container?
  13. Set custom name to a docker container
  14. Access docker container filesystem & terminal
  15. Getting docker details using docker inspect
  16. Kyverno – Installation, Policies, Testing, Reporting, Monitoring, Security
  17. Complete Kubernetes Project Step By Step
  18. Introduction to Kubernetes Objects

This is Akash Mittal, an overall computer scientist. He is in software development from more than 10 years and worked on technologies like ReactJS, React Native, Php, JS, Golang, Java, Android etc. Being a die hard animal lover is the only trait, he is proud of.

Related Tags
  • docker,
  • docker error

Содержание

  1. Fixing exec format errors with Docker ENTRYPOINT Scripts on Windows
  2. You may have gotten cryptic errors when trying to use ENTRYPOINT scripts in your images while running Windows. Here’s how to fix them.
  3. Does This Error Look Familiar?
  4. My ENTRYPOINT Script Was Super Basic
  5. Time to Investigate the Dockerfile
  6. Thought Process on Debugging This Further
  7. Resolving the Error on IRC
  8. Configuring VSCode and WSL for LF Line Endings
  9. Installing and Using dos2unix
  10. BONUS: Applying This Process to Other Problems
  11. Free Intro to Docker Email Course
  12. standard_init_linux.go:228: exec user process caused: exec format error
  13. Error due to #!/bin/bash
  14. Character Encoding ( LF / CRLF )
  15. Architecture Mismatch ( x86 / ARM )
  16. Script encoding ( UTF8 + BOM )
  17. ‘docker run’ throws “exec user process” errors
  18. The Dockerfile
  19. Linefeeds matter: no such file or directory
  20. Encoding matters: exec format error
  21. Conclusion

Fixing exec format errors with Docker ENTRYPOINT Scripts on Windows

You may have gotten cryptic errors when trying to use ENTRYPOINT scripts in your images while running Windows. Here’s how to fix them.

Docker ENTRYPOINT scripts are a wonderful thing, but it’s not so wonderful when they start failing in unexpected ways, especially when you’re very confident that “identical” ENTRYPOINT scripts worked on other Docker hosts.

Does This Error Look Familiar?

standard_init_linux.go:195: exec user process caused «exec format error»

I’m not someone who hacks on the Docker code base itself but when I encountered this error, the exec caught my eye. I thought “hmm, well I’m using exec «$@» in my entrypoint, maybe something is wrong with that?”.

But I knew there wasn’t much that could go wrong because the script did nothing especial.

My ENTRYPOINT Script Was Super Basic

It does nothing except pass control back to whatever process is ran in your CMD instruction in your Dockerfile . That’s what exec «$@» does.

Setting #!/bin/sh is standard for setting up a shell environment. This is exactly what the official PostgreSQL image uses in its ENTRYPOINT script. It also uses set -e which tells your shell to halt on any error, and finally it also ends its script off with exec «$@» .

Using that logic, we can conclude without a doubt that there is nothing wrong with the above script in terms of syntax, yet it continues to throw that exec error.

Time to Investigate the Dockerfile

If the script isn’t the issue then it must be the ENTRYPOINT instruction or something to do with permissions on the script itself. Here’s the important bits of the Dockerfile :

If I’ve learned anything from working as a web developer for the last

20 years, it’s that you should never trust anything from the client.

In this context, that means I shouldn’t trust that the script is already executable when building the Docker image, so even though it adds an extra layer to the image, it’s important to chmod +x the script in the Dockerfile .

I was already doing that because I’ve been bit by that issue in the past.

The entrypoint location is also normal. That’s the absolute path to where it exists inside of the Docker image (it was COPY ‘d in a previous step not listed above).

Thought Process on Debugging This Further

At this point the Docker image builds but it fails to run due to the script. The next step is simple then, just comment out the ENTRYPOINT instruction and re-build it. Sure enough, the image builds and runs correctly.

With this new information we now have 5 facts:

  1. The script itself has no syntax errors
  2. The script is most definitely executable
  3. The Docker image builds, so the ENTRYPOINT has the correct file location
  4. A very popular Docker image (PostgreSQL) is using a nearly identical entrypoint
  5. The script is causing the error because it works without the ENTRYPOINT instruction

It’s unlikely there’s something wrong with the Docker daemon since the PostgreSQL image confirms it works, so I’m happy to rule that out considering I’ve ran the PostgreSQL image using the same Docker daemon version as I did with my entrypoint script.

Resolving the Error on IRC

At this point my eye was starting to twitch, and when that happens, that means it’s time to ask for external help, so I hopped on IRC.

I explained the situation and within a few minutes we uncovered the issue. I’m including the conversation here because I think the process is what’s important, not the solution:

Looking back, I like ada’s comment here about questioning me on what I meant by “works”. When it comes to real time communication, sometimes you don’t pick your words wisely. What I should have said was the Docker image builds successfully.

Anyways, let’s continue with the conversation:

Yep, I used the word “literally” wrong here because it had set -e and empty lines too! I just wanted to keep the script short on IRC (terrible idea btw).

Oh, now that’s a good idea. I didn’t even think about executing the script manually inside of the container. Thinking back, that was such an obvious thing to do, but guess what, this is how you learn.

If an entrypoint script ever goes wrong in the future for me, or if one of the people taking my Docker course has a problem with an entrypoint script, you can be sure running it in the container directly will be near the top of my list of things to do / ask.

Ok, so, what’s line 3 of the script? Ah, it’s an empty new line. Side note, I didn’t include my exact script when asking for help which was a mistake because from their POV, line 3 was something different. Never try to be tricky when asking for help, but that’s a lesson for another day!

I have to admit, seeing foundypoint.sh there threw me off. What the heck does that have to do with anything. Looking at it now, the entire error is : not foundypoint.sh: 3: docker-entrypoint.sh:

That really says “not found” and point.sh is part of the docker-entrypoint.sh file name. Why it came out like that is above my pay grade, but at least it could in theory make some sense now.

Well, now it’s starting to add up. Guess who moved their code editor to be running in Windows the other month? Also, guess who recently moved to using VSCode? This guy!

Prior to that, I was running Sublime Text in a Linux driven VM for the last

5 years. CRLF vs LF line endings isn’t something I dealt with in over 5+ years.

Let’s continue with the story because it shows how to detect the issue and resolve it.

Things are starting to drift a little off topic, but ada guides us back to the main problem.

Bingo, that confirms the issue. Pesky CRLF line endings ( rn ) are in the file. The PostgreSQL entrypoint script has Unix style LF line endings ( n ), but most code editors and GitHub don’t visibly show this, so it was invisible to the naked eye.

Special thanks to ada, programmerq and mgolisch for helping solve this mystery.

Now we know what we need to do, so let’s do it.

Configuring VSCode and WSL for LF Line Endings

Forcing Unix line endings in VSCode was very straight forward. Just drop this into your user settings: «files.eol»: «n» . You could alternatively place that into a workspace setting for specific projects, in case you have projects that run on both Linux and Windows.

New files that you create should have a LF in the bottom right of the VSCode window instead of CRLF, but existing files that have CRLF line endings will continue to be CRLF.

Installing and Using dos2unix

From within WSL run sudo apt-get install dos2unix to install a utility that will automatically convert CRLF to LF.

Then just use it on a file by running dos2unix docker-entrypoint.sh or whatever file you’re converting. Done deal!

Now if you ran file docker-entrypoint.sh it would look like this instead: docker-entrypoint.sh: POSIX shell script, ASCII text executable . It no longer has with CRLF line terminators as we saw in the IRC chat log.

Of course, if you’ve been setting CRLF line endings for a project, you probably have a ton of files to convert and doing it 1 by 1 would be really tedious.

For that you can use the power of Unix pipes to recursively run dos2unix against a directory path of your choosing.

Recursively run dos2unix against all files in a path:

All you have to do is run find . -type f -print0 | xargs -0 dos2unix .

That will run it against the current directory. Replace . with a different path if you want.

If you’ve made it this far, now you know why the problem happened and how to fix it.

BONUS: Applying This Process to Other Problems

This is why I stand by the statement that breaking down problems is the #1 skill to have as a software developer. The solution was simple once the problem was understood and we got there by breaking things down and using a process of elimination.

And in case you’re wondering, I most definitely used the Rubber Duck debugging technique before I asked for help on IRC.

Have you ever been bit by CRLF vs LF line endings? Let me know below!

Free Intro to Docker Email Course

Over 5 days you’ll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you’ll have hands on experience using Docker to serve a website.

Источник

standard_init_linux.go:228: exec user process caused: exec format error

Table of Contents Hide

Docker throws error standard_init_linux.go:228: exec user process caused: exec format error when there are issues with executable file format. It could happen due to these reasons –

  1. You forgot to put #!/bin/bash at the top of shell files.
  2. There is a space before shebang ( #!/bin/bash ).
  3. Newline character encoding is wrong ( LF / CRLF )
  4. Using #!/bin/bash instead of #!/bin/ash for alpine images.
  5. Architecture mismatch like running x86 image on ARM systems.
  6. Script encoding issue – UTF8 + BOM

Error due to #!/bin/bash

There are few things regarding shebang.

  1. There should not be anything before it. Shebang should be the first text in the shell file. Check for spaces, empty lines, hidden characters etc. before it.
  2. Always include it in the shell files. This proves that the file is executable.
  3. Use the right command. If it’s a bash file, use #!/bin/bash , if shell file then use #!/bin/sh and if alpine image then #!/bin/ash .
  4. Don’t forget # . People use to forget it.

Character Encoding ( LF / CRLF )

Character encoding is an underdog which creates a number of issues in coding. This happens due to new line styles of various operating systems. For example –

  • Windows uses CRLF (Carriage Return Line Feed). It’s new line is rn .
  • Linux uses LF (Line Feed). It’s new line is n .

When you create codes on Windows, the files uses CRLF encoding. After you deploy them on Linux container it creates encoding issues.

Sometimes this creates standard_init_linux.go:228: exec user process caused: exec format error. So, it’s a good practice to change encoding preferences in your code editors like vscode and notepad++ to LF on Windows.

Architecture Mismatch ( x86 / ARM )

This is the most common issue of exec format error. Take care of these points –

  1. Apple M1 is not of same architecture as of Apple Intel chip. Apple M1 has AMD64 architecture while intel is ARM .
  2. See if you are running 32bit or 64bit operating system.
  3. You can’t build image on ARM and run on AMD64 .

Solution is to use buildx utility of Docker –

Script encoding ( UTF8 + BOM )

Script encoding also seems to be causing issues. Especially on windows systems. So, you will need to check if your executable file is saved as UTF8 or UTF8+BOM . BOM stands for Byte Order Mark. Generally, UTF8 files works fine.

Источник

‘docker run’ throws “exec user process” errors

When recently creating a Linux Docker image using Docker Desktop for Windows , I ran into a couple of vague errors. Searching online for the error messages, there weren’t any solutions. But luckily some suggestions put me on the right track.
In this post I describe the solutions I found. Hopefully preventing you wasting time on the same issues.

The Dockerfile

My Dockerfile is based on the Azure App Service WordPress 0.3 Dockerfile .
In relation to the errors I encountered, the most important part in this file is the ENTRYPOINT that is declared:

After adding the entrypoint.sh file to the directory where I build my image, I ran the docker build command:

Once the build was completed, I launched the image locally:

But that was not as straight forward as expected.

Linefeeds matter: no such file or directory

First, I got the following response:

standard_init_linux.go:195: exec user process caused «no such file or directory»

This is quite a generic error message and can describe a lot of files or directories that are part of the process of building and running Docker images and containers. My first impression was that the image building was not working correctly. But after a lot of rebuilds, the error didn’t go away.
I finally found the real source of the issue: changing the linefeeds in the entrypoint.sh file from to , somehow made the file discoverable.

Visual Studio Code showing CRLF in the status bar Changing the linefeed option

However, I still couldn’t run my container, only the error message had changed.

Encoding matters: exec format error

Executing the docker run command again, the output was now a different error:

standard_init_linux.go:195: exec user process caused «exec format error»

The mentioning of a format error made me guess that this had something to do with incompatibilities running a Linux image on a Windows OS , or something related to . . Many articles you’ll find searching on the error message are pointing in that direction.

Luckily, I overheard a colleague solving a completely unrelated issue by changing the encoding of his file from -8 to -8859-15 . I figured to just try that with my file. solving the issue!

Save the file with reencoding Select the file encoding

Conclusion

When using Docker on Windows and working with Linux containers, make sure the encoding and linefeeds of the files involved are correct, otherwise you are hit with vague error messages that are not helpful at all.

Источник

Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

Понравилась статья? Поделить с друзьями:
  • Exec format error for command
  • Exception 0x1333 generation failed как исправить assassins creed valhalla
  • Exec format error docker compose
  • Except socket error msg
  • Exec format error android