Skip to content

Common Docker Commands

Chopicalqui edited this page Feb 19, 2022 · 1 revision

Starting all KIS Docker containers

We start all KIS Docker containers by executing the following command:

docker-compose --file ~/.kis/docker-compose.yml run -d --name kaliintelsuite kaliintelsuite

If we receive an error message like the following, then we need to remove the Docker container kaliintelsuite first.

Creating kaliintelsuite_kaliintelsuite_run ... error

ERROR: for kaliintelsuite_kaliintelsuite_run  Cannot create container for service kaliintelsuite: Conflict. The container name "/kaliintelsuite" is already in use by container "52094356a8d75167321ff34b616848ae163b702ba3d61d6ec82ce255f5fb7f4a". You have to remove (or rename) that container to be able to reuse that name.

ERROR: for kaliintelsuite  Cannot create container for service kaliintelsuite: Conflict. The container name "/kaliintelsuite" is already in use by container "52094356a8d75167321ff34b616848ae163b702ba3d61d6ec82ce255f5fb7f4a". You have to remove (or rename) that container to be able to reuse that name.
ERROR: Encountered errors while bringing up the project.

We remove the currently existing Docker container kaliintelsuite by executing the following command:

docker container rm kaliintelsuite -f

Database operations

Create and restore KIS database backup

We can create a backup of the entire KIS database and store it in file $backup by executing the following command:

docker exec -t kaliinteldb pg_dumpall -c -U kis > $backup

A restore of the backup file $backup can be accomplished by executing the following commands:

# first, drop the current database
docker exec -it kaliintelsuite kismanage database --drop

# restore the database backup
cat $backup | docker exec -i kaliinteldb psql -U kis -d kis

Run SQL command in the KIS database

docker exec -i kaliinteldb psql -U kis -d kis -c "SELECT * FROM version;"