V tomto příspěvku ukáži rozchození IBM relačního databázového systému Informix v Dockeru.
docker run -it --name ifx --privileged -p 9088:9088 -e LICENSE=accept ibmcom/informix-developer-database:latest
Stáhne image s informixem a vytvoří kontejner s názvem ifx.
-p 9088:9088
vystavení interního portu 9088 ven
-e LICENSE=accept
pro používání informixu je třeba souhlasit s licenčními podmínkami
-i
interaktivní
-t
pseudo terminál
Výstup uvedeného příkazu bude zhruba následující:
############################################### # Informix container login Information: # user: informix # password: ############################################### ### Type exit to quit the Startup Shell ### This will stop the container ### For interactive shell run: ### docker exec -it 22a1c8bd74d1 bash ### To start the container run: ### docker start 22a1c8bd74d1 ### To safely shutdown the container run: ### docker stop 22a1c8bd74d1 checkpoint to complete. 11:34:27 Results: The size of individual logical log files is too small for the current workload, resulting in each log file filling very quickly. If log files fill in less than 30 seconds, the checkpoint might remain blocked because the last log file fills during the time needed to perform the checkpoint. 11:34:27 Action: Increase the size of the individual logical log files so that it takes at least 30 seconds to fill each one. Look at the online log to determine how quickly the log files are filling, and then increase the size of the files proportionately. 11:34:28 Dynamically allocated new virtual shared memory segment (size 8192KB) 11:34:28 Memory sizes:resident:4988 KB, virtual:40848 KB, message:0, bufferpool:110632, SHMTOTAL:16777216 KB 11:34:28 Logical Log 2 Complete, timestamp: 0x2ac47. 11:34:28 Process exited with return code 126: /bin/sh /bin/sh -c /opt/ibm/informix/etc/alarmprogram.sh 2 23 "Logical Log 2 Complete, timestamp: 0x2ac47." "Logical Log 2 Complete, timestamp: 0x2ac47." "" 23001 starting rest listener on port 27018 starting mongo listener on port 27017 starting mqtt listener on port 27883 11:34:29 Dynamically allocated new virtual shared memory segment (size 8192KB) 11:34:29 Memory sizes:resident:4988 KB, virtual:49040 KB, message:0, bufferpool:110632, SHMTOTAL:16777216 KB 11:34:31 SCHAPI: Using (/opt/ibm/informix/etc/sysadmin/sch_init_informix.sql) to initialize this instance. 11:34:31 SCHAPI: Started dbScheduler thread. 11:34:31 'sysadmin' database built successfully. 11:34:31 Auto Registration is synced 11:34:31 Updating Low Memory Manager to version 11 11:34:31 Installing patch to Low Memory Manager code. version(11.01) 11:34:31 Installing patch to upgrade ph_task code. version(13.10) 11:34:32 SCHAPI: Started 2 dbWorker threads. 11:34:32 Checkpoint Completed: duration was 2 seconds. 11:34:32 Mon Apr 13 - loguniq 3, logpos 0xa4b080, timestamp: 0x34381 Interval: 6 11:34:32 Maximum server connections 1 11:34:32 Checkpoint Statistics - Avg. Txn Block Time 0.000, # Txns blocked 1, Plog used 178, Llog used 5190
Příkaz je spuštěn v interaktivním režimu (-it
). Ukončete terminál (Ctrl + C
). Někdy je třeba zopakovat několikrát. Pokud si nyní zobrazíte seznam images, naleznete tam i informix.
docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE ibmcom/informix-developer-database latest c0b0e4b5bedb 3 weeks ago 880MB
Kontejner je pojmenovaný jako ifx (díky volbě --name ifx
) a pro jeho spuštění použijte tento příkaz:
docker run ifx
To, že kontejner běží zkontrolujete příkazem docker ps.
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 22a1c8bd74d1 ibmcom/informix-developer-database:latest "/opt/ibm/scripts/di…" 9 minutes ago Up About a minute (healthy) 8080/tcp, 9089/tcp, 27017-27018/tcp, 27883/tcp, 0.0.0.0:9888->9088/tcp ifx
V kontejneru spusťte bash.
docker exec -it ifx bash
Nyní jste v kontejneru a může dávat příkazy. Jelikož nás zajímá databáze informix, podíváme se co v kontejneru máme. K tomu použime příkaz dbaccess (https://www.ibm.com/support/knowledgecenter/SSGU8G_14.1.0/com.ibm.dba.doc/ids_dba_018.htm).
dbaccess DBACCESS: Query-language Connection Database Table Session Exit Use SQL query language. ------------------------------------------------ Press CTRL-W for Help --------
Vytvoříme si databázi my_db: Database -> Create -> napiště název vytvářené databáze
CREATE DATABASE >>my_db Enter the name you want to assign to the new database, then press Return. ----------------------- @informix -------------- Press CTRL-W for Help --------
Pokud se nyní vrátíte do hlavního menu a zvolíte Database -> Select, bude nově vytvořená databáze již existovat.
SELECT DATABASE >> Select a database with the Arrow Keys, or enter a name, then press Return. ----------------------- @informix -------------- Press CTRL-W for Help -------- my_db@informix sysadmin@informix sysmaster@informix sysuser@informix sysutils@informix