I can't see the container after docker run

hi guys,

why i can’t see the container after docker run ?

allen@allens-MacBook-Pro getting-started-app % docker run -dp 127.0.0.1:3000:3000
-w /app -v “$(pwd):/app”
–network todo-app
-e MYSQL_HOST=mysql
-e MYSQL_USER=root
-e MYSQL_PASSWORD=secret
-e MYSQL_DB=todos
node:18-alpine
sh -c “yarn install && yarn run dev”
efa9a1ce7c8337da1a969fc43eb63d8dcbab27150c4b5fe1b14e21d26530608a

when i use docker ps I can’t see the container :slight_smile:

allen@allens-MacBook-Pro getting-started-app % docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9f2b0247dd50 mysql:8.0 “docker-entrypoint.s…” 15 minutes ago Up 15 minutes 3306/tcp, 33060/tcp nice_booth
f6bea48053a1 7a3f95c07812 “/docker-entrypoint.…” 19 hours ago Up 17 hours 0.0.0.0:10086->80/tcp Hellokitty


Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
services:
  service1:
    image: image1
```

After fixing your post, please send a new comment so people are notified about the fixed content.


It probably failed and stopped. Try docker ps -a

thanks akos,

when i use docker ps -a I can see the container :slight_smile:

allen@allens-MacBook-Pro getting-started-app % docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
331135cd0b17 node:18-alpine “docker-entrypoint.s…” 4 seconds ago Exited (0) 3 seconds ago happy_shaw

Yup, the container had a single process - Install using yarn, then stop and exit

Thanks dean,

I just follow the documentation, how can i make it running if i still using these script ?

docker run -dp 127.0.0.1:3000:3000
-w /app -v “$(pwd):/app”
–network todo-app
-e MYSQL_HOST=mysql
-e MYSQL_USER=root
-e MYSQL_PASSWORD=secret
-e MYSQL_DB=todos
node:18-alpine
sh -c “yarn install && yarn run dev”

again

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.