Helpful Docker Service Commands

Prev Next

WHAT TO EXPECT

In this section, users will find helpful Docker commands used during cloudSwXtch, swXtchBridge, and Licensing Server installations and upgrades.

List containers

docker ps

This command will list all the Docker containers currently running on your machine.

docker ps

Example Output

$ docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED       STATUS        PORTS                                               NAMES
eb75bf825142   swx-swxtch:latest   "./entrypoint.sh"        10 days ago   Up 30 hours                                                       swx-swxtch
bd29e86862f0   registry:2          "/entrypoint.sh /etc…"   10 days ago   Up 30 hours   0.0.0.0:443->443/tcp, [::]:443->443/tcp, 5000/tcp   registry

Container ID

Using docker ps  will list all the container IDs found on your machine. You will use these for other commands in this article.

Show logs

docker logs

This command will list the logs related to a container. For example, use the follow command and give the last 10 lines:

docker logs <container> -f -n 10

Example Output

$ docker logs swx-swxtch -f -n 10
swx-repl: USER1: RX: mempool_avail 223738
swx-repl: USER1: CTRL: mempool_avail 65531
info: launcher.go:39: swx-repl: USER1: TX: Total:258483929  Rate:16801-pps
swx-repl: USER1: RX: Load[21%  1%]  Total:258497634  Rate:16800-pps
swx-repl: USER1: RX: mempool_avail 223708
swx-repl: USER1: CTRL: mempool_avail 65531
info: launcher.go:39: swx-repl: USER1: TX: Total:258567918  Rate:16796-pps
swx-repl: USER1: RX: Load[21%  1%]  Total:258581681  Rate:16807-pps
swx-repl: USER1: RX: mempool_avail 223669
swx-repl: USER1: CTRL: mempool_avail 65531

PLEASE NOTE

There are othe ways to check the logs. Please read the How to View cloudSwXtch and swXtchBridge Logs using shell page.

Stop a container

docker stop

This command stops a Docker container on the VM.

docker stop <container>

Example Output

$ docker stop swx-swxtch
swx-swxtch

Start a container

docker start

This command starts the Docker container on the VM.

$ docker start <container>

$ docker start swx-swxtch
swx-swxtch

Remove a container

docker remove

This command will remove the Docker container from the VM.

$ docker rm <container>

Example Output

$ docker rm swx-swxtch
swx-swxtch

PLEASE NOTE

Removing a container will not remove the image used to create it. Images are rmoved using docker rmi <image>