Skip to content

How to work with contrail containers | cheatsheet

Harish Kumar edited this page Jan 23, 2017 · 5 revisions

From 4.0 contrail services will be deployed as containers, so one should have knowledge to connect to docker containers and work with in order to work with contrail services.

List running containers

$ docker ps
CONTAINER ID        IMAGE                                                         COMMAND                  CREATED             STATUS              PORTS               NAMES
6c0055355c60        10.84.34.155:5000/contrail-kube-manager-u14.04:4.0.0.0-3023   "/bin/sh -c /entrypoi"   14 hours ago        Up 14 hours                             contrail-kube-manager
348282f24e5b        10.84.34.155:5000/contrail-analytics-u14.04:4.0.0.0-3023      "/bin/sh -c /entrypoi"   14 hours ago        Up 14 hours                             analytics
714bf0fa9e28        10.84.34.155:5000/contrail-analyticsdb-u14.04:4.0.0.0-3023    "/bin/sh -c /entrypoi"   14 hours ago        Up 14 hours                             analyticsdb

List ALL containers including failed/EXited containers

$ docker ps -a
CONTAINER ID        IMAGE                                                         COMMAND                  CREATED             STATUS              PORTS               NAMES
6c0055355c60        10.84.34.155:5000/contrail-kube-manager-u14.04:4.0.0.0-3023   "/bin/sh -c /entrypoi"   14 hours ago        Up 14 hours                             contrail-kube-manager
348282f24e5b        10.84.34.155:5000/contrail-analytics-u14.04:4.0.0.0-3023      "/bin/sh -c /entrypoi"   14 hours ago        Up 14 hours                             analytics
714bf0fa9e28        10.84.34.155:5000/contrail-analyticsdb-u14.04:4.0.0.0-3023    "/bin/sh -c /entrypoi"   14 hours ago        Up 14 hours                             analyticsdb
b718fd94857d        10.84.34.155:5000/contrail-controller-u14.04:4.0.0.0-3023     "/bin/sh -c /entrypoi"   14 hours ago        Exited 14 hours ago                             controller
a5eb1a8122bc        10.84.34.155:5000/contrail-repo-centos:4.0.0.0-3023           "/bin/sh -c /entrypoi"   14 hours ago        Exited 14 hours ago                             contrail-repo-centos

Connect to specific container

Run the command "docker exec -it bash" to connect to the container and get bash prompt

Once you connect to the container, you can work as if you are in the machine where controller services are running (like accessing logs from /var/log/contrail etc).

[root@harish-centos-test-1 ~]# docker exec -it controller bash
root@harish-centos-test-1:/# 

Note that at this moment you would see similar prompt within the container and outside of container, but running "ps -efw" within the container only shows the process running within that container.

root@harish-centos-test-1:/# ps -efw
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Jan05 ?        00:00:00 /bin/sh -c /entrypoint.sh
root        12     1  0 Jan05 ?        00:00:00 bash /entrypoint.sh
rabbitmq   306     1  0 Jan05 ?        00:00:00 /usr/lib/erlang/erts-5.10.4/bin/epmd -daemon
rabbitmq  1085     1  0 Jan05 ?        00:06:30 /usr/lib/erlang/erts-5.10.4/bin/beam.smp -W w -K true -A30 -P 1048576 -- -root /usr/lib/erlang -progname erl -- -home /var/lib/rabbitmq -- -pa /usr/lib/ra
rabbitmq  1258  1085  0 Jan05 ?        00:00:00 inet_gethost 4
rabbitmq  1259  1258  0 Jan05 ?        00:00:00 inet_gethost 4
cassand+  1624     1  2 Jan05 ?        00:22:26 java -ea -javaagent:/usr/share/cassandra/lib/jamm-0.3.0.jar -XX:+CMSClassUnloadingEnabled -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms512M -X
zookeep+  1926     1  0 Jan05 ?        00:01:51 /usr/bin/java -cp /etc/zookeeper/conf:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs
redis     4422     1  0 Jan05 ?        00:01:03 /usr/bin/redis-server 127.0.0.1:6379       
root      4538    12  0 Jan05 ?        00:00:15 /usr/bin/python /usr/bin/supervisord -n -c /etc/contrail/supervisord.conf
root      4539    12  0 Jan05 ?        00:00:00 tee -a /var/log/supervisord.log
root      4543  4538  0 Jan05 ?        00:01:42 /usr/bin/python /usr/bin/supervisord -n -c /etc/contrail/supervisord_config.conf
root      4544  4538  0 Jan05 ?        00:00:34 /usr/bin/python /usr/bin/supervisord -n -c /etc/contrail/supervisord_webui.conf
root      4545  4538  0 Jan05 ?        00:00:24 /usr/bin/python /usr/bin/supervisord -n -c /etc/contrail/supervisord_control.conf
root      4552  4544  0 Jan05 ?        00:00:01 node webServerStart.js
root      4553  4544  0 Jan05 ?        00:00:00 node jobServerStart.js
root      4554  4543  0 Jan05 ?        00:00:58 python /usr/bin/contrail-nodemgr --nodetype=contrail-config
contrail  4555  4543  0 Jan05 ?        00:01:20 /usr/bin/java -jar ./irond.jar -Dlog4j.configuration=file:////usr/share/ifmap-server/log4j.properties
root      4557  4543  0 Jan05 ?        00:03:06 /usr/bin/python /usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf --conf_file /etc/c
contrail  4558  4543  0 Jan05 ?        00:00:27 /usr/bin/python /usr/bin/contrail-device-manager --conf_file /etc/contrail/contrail-device-manager.conf --conf_file /etc/contrail/contrail-keystone-auth.c
contrail  4559  4543  0 Jan05 ?        00:00:27 /usr/bin/python /usr/bin/contrail-schema --conf_file /etc/contrail/contrail-schema.conf --conf_file /etc/contrail/contrail-keystone-auth.conf
root      4560  4545  0 Jan05 ?        00:00:48 python /usr/bin/contrail-nodemgr --nodetype=contrail-control
contrail  4562  4545  0 Jan05 ?        00:03:52 /usr/bin/contrail-control
contrail  4563  4545  0 Jan05 ?        00:04:08 /usr/bin/contrail-dns
root      4647  4553  0 Jan05 ?        00:00:26 /usr/bin/node /usr/src/contrail/contrail-web-core/jobServerStart.js
root      4746  4552  0 Jan05 ?        00:02:34 /usr/bin/node /usr/src/contrail/contrail-web-core/webServerStart.js
contrail  4939  4545  0 Jan05 ?        00:00:00 /usr/bin/contrail-named -f -c /etc/contrail/dns/contrail-named.conf
contrail  5216  4543  0 Jan05 ?        00:00:38 /usr/bin/python /usr/bin/contrail-svc-monitor --conf_file /etc/contrail/contrail-svc-monitor.conf --conf_file /etc/contrail/contrail-keystone-auth.conf
contrail  5238  4543  2 Jan05 ?        00:18:23 /usr/bin/python /usr/bin/contrail-discovery --conf_file /etc/contrail/contrail-discovery.conf --worker_id 0
root      6168     0  0 04:49 ?        00:00:00 bash
root      6519  6168  0 04:52 ?        00:00:00 ps -efw

See the container startup log

[root@harish-centos-test-1 ~]# docker logs controller

Services running within specific containers

Please refer contrail-docker spec for details about contrail containers and what services running on which containers.

Clone this wiki locally