Managing your containers
List your containers
Run the levv ps command to list all containers running in your default project:
$ levv ps
No project name has been specified, your default project will be used (example).
Getting containers status successful
PROJECT SERVICE NAME IMAGE PORTS STATUS CPU MEMORY RESTARTS AGE
myproject myapp-1 myapp-1-6d664b766f-txqkk myapp-1:latest 80:8000/tcp Running 0m 0MB 0 1h10m
myproject myapp-1 myapp-1-6d664b766f-xtdhz myapp-1:latest 80:8000/tcp Running 0m 54MB 0 25d42m
myproject myapp-2 myapp-2-6ff4fcbcc-69wtk myapp-2:latest Crash Loop n/a n/a 666 (5m24s ago. Reason: Out of Memory)
myproject myapp-3 myapp-3-5879477fdf-45t5h myapp-3:mytag Unknown n/a n/a 1 (25d46m ago. Reason: Container ephemeral local storage usage exceeds the total limit of containers 1Gi. ) 25d47m
myproject myapp-3 myapp-3-5879477fdf-xtdhz myapp-3:mytag Running 0m 54MB 0 25d46m
Containers may have one the following statuses:
| Status | Description |
|---|---|
| Unknown | The state of the container could not be obtained (e.g. the container restarted and has been replaced by new one). |
| Creating | The container is being created. |
| Running | The container is executing without issues. |
| Terminating | The container is being deleted. |
| Completed | The container has successfully completed. |
| Error | The container exited with an error (non-zero exit status). |
| Out of Memory | The container is terminated because it has exceeded its memory limit. |
| Image Pull Error | The container image pull failed. |
| Crash Loop | The container is failing to start repeatedly. The reason for the last restart is visible in the RESTARTS column. |
Inspect container logs
Run the levv logs command inspect container logs:
$ levv logs myapp-1
No project name has been specified, your default project will be used (dev).
Getting logs successful
httpd started
Execute commands in a running container
Run the levv exec command to execute commands in a running container:
$ levv exec myapp-1 ps
PID USER TIME COMMAND
1 root 0:00 /bin/sh -c echo "httpd started" && trap "exit 0;" TERM INT; httpd -v -p $PORT -h /www -f & wait
7 root 0:00 httpd -v -p 8000 -h /www -f
17 root 0:00 ps
Have a look at this blog post for more
information on levv exec.