My container automatically got exited

Hi
i have ran multiple container on my host machine those are mysql , and npm container .

here are the exited conatiner list

sudo docker ps -a
CONTAINER ID   IMAGE                                                               COMMAND                  CREATED        STATUS                    PORTS     NAMES
17151cba6b48   mysql:5.7                                                           "docker-entrypoint.s…"   21 hours ago   Exited (0) 12 hours ago             database
db3684ddecf1   pocketful-landing-page-next:2.0.11-f705a08   "docker-entrypoint.s…"   22 hours ago   Exited (0) 12 hours ago             landingpage-next
f351665d9faa  seo-tools:1.0.10-19f1b50                     "docker-entrypoint.s…"   22 hours ago   Exited (1) 12 hours ago             seo-tool
69e8d619a5e3   seo-web:1.0.10-bf73fbd                       "docker-entrypoint.s…"   23 hours ago   Exited (1) 12 hours ago             calc

here i am showing one container logs

> calculator@0.1.0 start
> env-cmd -e local next start -p 3000

   ▲ Next.js 14.1.0
   - Local:        http://localhost:3000

 ✓ Ready in 403ms

 ⚠ metadata.metadataBase is not set for resolving social open graph or twitter images, using "http://localhost:3000". 
 ⚠ The "images.domains" configuration is deprecated. Please use "images.remotePatterns" configuration instead.
npm notice
npm notice New minor version of npm available! 10.7.0 -> 10.8.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.1
npm notice To update run: npm install -g npm@10.8.1
npm notice
npm error path /app
npm error command failed
npm error signal SIGTERM
npm error command sh -c env-cmd -e local next start -p 3000

npm error A complete log of this run can be found in: /root/.npm/_logs/2024-06-06T06_34_07_377Z-debug-0.log

i have checked this file is not present inside my conatiner and also host machine “/root/.npm/_logs/2024-06-06T06_34_07_377Z-debug-0.log”

i have checked inisde my conatiner npm is present but inside host machine npm is not present

here is the docker service logs which i ma seeing through journalctl command

“2024-06-07T05:23:58.906455728Z” level=error msg=“failed to close container stdin” container=7d54962a8034ecf97c2600f568405813b861a10a6e06876fb2c7d85f4306ad65 error=“process does not exist dee3a1e43a4594ef56c86c1b6dbbcf68898e59316c97d4b0c9745a704472b839: not found” module=libcontainerd namespace=moby

here are the error i am getting for single container i am provided for other cintainer also i am getting error like this .

if suppose other application exited automatically beacause of “”/root/.npm/_logs/2024-06-06T06_34_07_377Z-debug-0.log"" not found may be beacause of npm is not present inside host machine , but why my sql server also exited .

can anyone help me regarding this issue ?

regards
Kishor Kumar Sahoo

Hi

Its hard to be sure, since we dont have the log file, but things you can try:

  1. You could try and map the /root/.npm/ folder to your host, so you can access the file when its created

  2. The error that you provided:

npm error path /app
npm error command failed

Could indicate that you’re missing a volume mapping to /app in the container.

Hi

i don’t think it is the issue of docker image beacause same image i am running working fine on other host machine .
And the log error i am provide during that error my conatiner is running too . it is not exited yet, it will exited automatically after sometime . those container which is already exited i am not able to see logs of those container.

this way i am adding my volume both host machine and able to see data inside volume

sudo docker run -dit -p 3001:3001 --name seo-tool -v /newdisk/seo-tools/:/app/logs/ ghcr.io/pocketful-tech/seo-tools:1.0.10-19f1b50

and i have checked inside docker container where my container got exited and got this npm file
~/.npm/_logs # ls -ltr
total 124
-rw-r–r-- 1 root root 118052 May 29 07:32 2024-05-29T07_32_13_618Z-debug-0.log
-rw-r–r-- 1 root root 577 May 29 07:34 2024-05-29T07_32_38_012Z-debug-0.log
-rw-r–r-- 1 root root 587 Jun 7 05:22 2024-06-07T05_22_57_816Z-debug-0.log

but in logs showing this file is not present “npm error A complete log of this run can be found in: /root/.npm/_logs/2024-06-06T06_34_07_377Z-debug-0.log” which i don;t know why, may be it is not able to write this file inside conatiner.

i think one difference i got is where my container is perfectly running fine is their my docker version is
Docker version 24.0.7, build afdd53b

and where my conatiner is exited their my docker version is
Docker version 26.1.4, build 5650f9b

And this i am getting while inspecting

"State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 1,
            "Error": "",
            "StartedAt": "2024-06-06T06:34:07.295038254Z",
            "FinishedAt": "2024-06-06T16:56:16.727548567Z"
        },

is any other information you need ?

i also tried to uninstalled this Docker version 26.1.4 and install this version Docker version 24.0.7 it is automatically download the 26.1.4 version too

sudo apt install docker-ce=5:24.0.7-1~ubuntu.20.04~focal
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  containerd.io docker-buildx-plugin docker-ce-cli docker-ce-rootless-extras docker-compose-plugin
Suggested packages:
  aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
  containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin
0 upgraded, 6 newly installed, 0 to remove and 23 not upgraded.
Need to get 22.6 MB/119 MB of archives.
After this operation, 421 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://download.docker.com/linux/ubuntu focal/stable amd64 docker-ce amd64 5:24.0.7-1~ubuntu.20.04~focal [22.6 MB]
Fetched 22.6 MB in 0s (91.1 MB/s)
Selecting previously unselected package containerd.io.
(Reading database ... 59507 files and directories currently installed.)
Preparing to unpack .../0-containerd.io_1.6.33-1_amd64.deb ...
Unpacking containerd.io (1.6.33-1) ...
Selecting previously unselected package docker-buildx-plugin.
Preparing to unpack .../1-docker-buildx-plugin_0.14.1-1~ubuntu.20.04~focal_amd64.deb ...
Unpacking docker-buildx-plugin (0.14.1-1~ubuntu.20.04~focal) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../2-docker-ce-cli_5%3a26.1.4-1~ubuntu.20.04~focal_amd64.deb ...
Unpacking docker-ce-cli (5:26.1.4-1~ubuntu.20.04~focal) ...

so while checking docker --version i am getting Docker version 26.1.4, build 5650f9b only.

Regards
kishor kumar sahoo