Db2

 View Only
Expand all | Collapse all

run db2 in container with podman on Windows

  • 1.  run db2 in container with podman on Windows

    Posted Mon October 09, 2023 09:52 AM

    I am being pressured to stop using docker desktop so I thought I'll have easy migration to podman on my Windows. I was wrong.

    TL/DR: how can I use podman on Windows to run ibmcom/db2 image with volume persisting data outside of the container (PERSISTENT_HOME=true)?

    I usually start ibmcom/db2 (ignoring icr.io migration for now) container like this:

    docker run -itd --name mydb2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=db2inst1 -e DBNAME=SOMENAME -v c:\db2data:/database ibmcom/db2

    uninstalled Docker desktop, installed podman and run equivalent command:

    podman run -itd --name podmandb2 --privileged=true -p 50002:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=db2inst1 -e DBNAME=SOMENAME -v C:\db2data2:/database ibmcom/db2

    this fails with error somewhere in the logs:

    The instance home directory "/database/config/db2inst1" is invalid because it is not owned by the user "db2inst1". Change the ownership of the home directory to be owned by the instance user and its primary group.

    I have also tried adding 

    -e PERSISTENT_HOME=false

    then the volume files start piling but db2 is not serving my database. Error in the container log is:

    SQL1326N  The file or directory "/database/data/" cannot be accessed.  (that directory appeared in the volume)

    And finally I tried to run without the volume (really not persiting)

    podman run -itd --name podmandb2-again --privileged=true -p 50003:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=db2inst1 -e DBNAME=SOMENAME -e PERSISTENT_HOME=false ibmcom/db2

    This one runs.



    ------------------------------
    Tvrtko Mrkonjić
    ------------------------------


  • 2.  RE: run db2 in container with podman on Windows

    Posted Tue October 10, 2023 11:21 AM

    try to put the whole thing in double quotes and using forward slashes 

    Options:

    1) -v "C:/db2data2":/database

    2) -v "C:/db2data2:/database"

    3) -v /c/db2data2:/database



    ------------------------------
    ENIO RUBENS BASSO
    ------------------------------