Db2

 View Only
Expand all | Collapse all

Simple Docker DB2 image setup fails

  • 1.  Simple Docker DB2 image setup fails

    Posted Tue May 12, 2020 09:44 AM
    I'm following the directions at: 

    https://hub.docker.com/r/ibmcom/db2

    The container creation with the instance creation is failing. I don't see how I can change the ownership of /database/config/db2inst1 as suggested below as this whole process is automatic.

    D:\>docker run -itd --name geotools-db2 --privileged=true -p 50004:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=mypw -v d:\docker-db2:/database ibmcom/db2
    d17d5919e031ad59cb44949d56a3272d4559e69aa7a2d1e24c8e76994d790d04

    D:\>docker logs -f geotools-db2
    (*) Previous setup has not been detected. Creating the users...
    (*) Creating users ...
    (*) Creating instance ...
    DBI1446I The db2icrt command is running.


    DB2 installation is being initialized.

    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.

    A major error occurred during the execution that caused this program to
    terminate prematurely. If the problem persists, contact your technical service
    representative.

    ------------------------------
    David Adler
    ------------------------------

    #Db2


  • 2.  RE: Simple Docker DB2 image setup fails

    IBM Champion
    Posted Wed May 13, 2020 03:02 AM
    Hi David,

    seems as you are running docker on windows. Have a look for this parameter:
    • PERSISTENT_HOME is true by default, only specify to false if you are running Docker for Windows.

    Set it to false and try to create container again.

    ------------------------------
    Markus Fraune
    ------------------------------



  • 3.  RE: Simple Docker DB2 image setup fails

    Posted Mon November 09, 2020 08:58 AM
    Hello Markus, you seem to be knowledgeable about this issue so I'll try asking you here. I am running into the very same error message but on Mac OS, starting from a clean slate (no pre-existing Docker containers, no pre-existing volumes) i.e. the command
    docker run -itd --name db2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=myPasswordWhatever -e DBNAME=testdb -v ~/Documents/tools/docker/volumes/db2/:/database ibmcom/db2
    results in
    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.

    If I check the filesystem of my Mac at ~/Documents/tools/docker/volumes/db2/ I can see Docker did create the config folder, and the db2inst1 underneath it, of course on my FS the folder is owned by my user (the db2inst1 user does not even exist as far as my OS is concerned).

    I'm running this on Mac OS Catalina 10.15.7 (19H2).

    ------------------------------
    Tommaso Meledina
    ------------------------------



  • 4.  RE: Simple Docker DB2 image setup fails

    IBM Champion
    Posted Mon November 09, 2020 11:21 AM
    Hi, I am still on 10.15.6 because @Michael Krafick wrote on Twitter that he had issues starting db2 on docker on mac with latest mac release.... I assume that you already checked the docker prefs. -> resources -> file sharing if your folder (or a parent one) is shared?

    Mike, can you assist here? Could you somehow fix it or was it maybe eliminated with a docker update?​

    ------------------------------
    Markus Fraune
    ------------------------------



  • 5.  RE: Simple Docker DB2 image setup fails

    Posted Mon November 09, 2020 11:28 AM
    Thanks Markus, in the meantime I tried using the same fix suggested for Windows i.e. adding the -e PERSISTENT_HOME=false bit when creating the container, and it indeed seems to work. Not sure it's a best practice, since on the documentation that property is clearly flagged as Windows-only, but so far I haven't encountered any issue.

    ------------------------------
    Tommaso Meledina
    ------------------------------



  • 6.  RE: Simple Docker DB2 image setup fails

    Posted Fri May 15, 2020 02:04 AM
    If docker is on Windows - must this be WIN  10 PRO?
    I tried to install  docker desktop on my WIN 10 Home machine -  with error message returned.

    Best regards
    Jürgen

    ------------------------------
    Jürgen Jost
    ------------------------------



  • 7.  RE: Simple Docker DB2 image setup fails

    IBM Champion
    Posted Fri May 15, 2020 02:50 AM
    Hi Jürgen,
    Docker on Windows needs Hyper-V to run its Linux machine. As Hyper-V is not available by default on Windows 10 Home, you will receive those errors. Search for Windows 10 Home Hyper-V and you will finde some easy instructions on how to activate even if not possible via system settings (you still have to fit hardware requirements like supported cpu).

    ------------------------------
    Markus Fraune
    ------------------------------



  • 8.  RE: Simple Docker DB2 image setup fails

    Posted Sat May 16, 2020 07:10 AM
    Hi  Markus,
    very good info.  on my Mac Catalina docker is running without any issue
    With 
    https://docs.microsoft.com/de-de/sysinternals/downloads/coreinfo
    i can check my system


    Jürgen Jost



    ------------------------------
    Jürgen Jost
    ------------------------------



  • 9.  RE: Simple Docker DB2 image setup fails

    Posted Tue November 10, 2020 02:49 PM
    for the history or some other people :-)
    Docker / DB2 works pretty good since 08/2020 on a 4 GB windows machine
    https://docs.docker.com/docker-for-windows/install-windows-home/
    PS
    on my Mac Mojave  I use a bind mount   -v <db storage dir>:/database​  to map a local storage dir into the container

    ------------------------------
    Jürgen Jost
    DB2 DBA (LUW / zOS)
    ------------------------------



  • 10.  RE: Simple Docker DB2 image setup fails

    Posted Mon May 18, 2020 08:26 AM
    The problem seems to have been resolved by adding "PERSISTENT_HOME=false" and removing the "-v" option on Windows. Without these changes I was unable to get it working.

    ------------------------------
    David Adler
    ------------------------------



  • 11.  RE: Simple Docker DB2 image setup fails

    Posted Tue May 19, 2020 09:32 AM
    Hi David,

    The default permissions using -v {volume:volume} on Docker Desktop are probably incorrect.
    Usually I make sure the entrypoint script sets the permissions for every bind volume mount point very early on.

    Hope this helps you externalise the database.

    ------------------------------
    Mark Johnson
    ------------------------------



  • 12.  RE: Simple Docker DB2 image setup fails

    Posted Wed August 12, 2020 10:14 AM
    The -v option on Docker Desktop for Windows requires additional Docker settings to be in place.  Open Docker Desktop settings, and add the file sharing resource as illustrated below.


    ------------------------------
    Gabrio Verratti
    ------------------------------



  • 13.  RE: Simple Docker DB2 image setup fails

    Posted Sun August 16, 2020 05:24 PM
    another way is using wsl2 and ubuntu bistro
    https://docs.microsoft.com/en-us/windows/wsl/wsl2-index
    you don't need ( and there is no such sreen) the file sharing above
    it works like with my favorite mac Catalina system

    ------------------------------
    Jürgen Jost
    ------------------------------