I can’t believe how long I worked on this crap and got…
NOWHERE!
It’s called icr.io/db2_community/db2:latest and says it was created 2 months ago.
Start Here.
So many questions. I know just enough about docker to get me in trouble, and even less about DB2. And the goal was to get some DB2 hands on, not learn about docker.
If I know some SQL, and I do, and was evaluating DB2 for a company, which I’m not… but someone like me could be. I would be frustrated!
I think DB2 is mostly just IBMs version of SQL. However IBM gave it a name that sounds nothing like SQL…DB2. Apple would probably name it iSQL. If I could just run a few simple SQL statements and see that it’s basically SQL. I, as a company representative, which I once was… would feel much better.
Create a docker image that will allow a potential customer to actually use it. Not a version that talks about DB2 instances, like I’m already a DB2 administrator.
So with that in mind…
Let’s start with Step 3
Log into your Docker container: sudo docker login
Container? What container? I haven’t even done a docker run. Docker Desktop shows no running containers
Concerning docker login, Docker Docs says… Authenticate to a registry
Below is a snapshot of what I’m talking about. So I won’t look crazy if they change it.

Is there even a reason to login to docker? I do docker pull… all the time. I never login first.
docker run parameters
The below parameter, used on the docker run commend seems to imply you’re creating /Docker on the root directory /
Would you want to do that even if you had administrator privileges?
-v /Docker:/database
Maybe suggest /home/userid/Docker
The .env_list file
Contains many things… lets start with
DB2INSTANCE=db2inst1
DB2INST1_PASSWORD=password
They describe these as…
DB2INSTANCE specifies the Db2 instance name
DB2INST1_PASSWORD specifies the password of the Db2 instance
That’s hardly enough info for me as a non DB2 person trying to see what DB2 is all about.
WTH is a Db2 instance name? Am I creating a password or supplying one I should know about?
I’m being facetious but, I assume the password for db2inst1 is password. Other wise maybe describe it like:
DB2INST1_PASSWORD=<insert a random password here>
Anywho. If you run, their example, you get…
bill@bill-MS-7B79:~/Docker$ docker run -h db2server --name db2server --restart=always --detach --privileged=true -p 50000:50000 --env-file .env_list -v /Docker:/database icr.io/db2_community/db2
1280f0711c01fe77a2c81071011cc9d4ed29d3f67113e34e4bcb2d39de053cca
bill@bill-MS-7B79:~/Docker$
bill@bill-MS-7B79:~/Docker$ docker exec -ti db2server bash -c "su - db2inst1"
su: warning: cannot change directory to /database/config/db2inst1: No such file or directory
[db2inst1@db2server /]$ bill@bill-MS-7B79:~/Docker$
bill@bill-MS-7B79:~/Docker$
It appears that the first step ran without problems and the second docker command failed. No actually the first command failed. But you wouldn’t know that by looking at the output.
Fortunately for me and no thanks to these instructions. I tried running an earlier version, and knew about…
docker logs -f db2server
Which produced a lot of output, but started with…
bill@bill-MS-7B79:~/Docker$ docker logs -f db2server
mkdir: cannot create directory ‘/database/config’: No such file or directory
touch: cannot touch '/database/config/instance.cfg': No such file or directory
awk: cmd. line:1: fatal: cannot open file `/database/config/instance.cfg' for reading: No such file or directory
/opt/ibm/db2/V12.1/bin/db2fupdt: line 254: /database/config/instance.cfg: No such file or directory
However, it did (if local) create those things that it complained “No such file or directory”
bill@bill-MS-7B79:~/db2Data/config$ ls -la
total 36
drwxr-xr-x 5 bill bill 4096 Dec 30 09:30 .
drwxr-xr-x 3 bill bill 4096 Dec 30 09:30 ..
d--------- 2 bill bill 4096 Dec 30 09:30 db2fenc1
drwxr-xr-x 3 bill bill 4096 Dec 30 09:30 db2icrt
d--------- 2 bill bill 4096 Dec 30 09:30 db2inst1
-rw-r--r-- 1 bill bill 76 Dec 30 09:30 instance.cfg
bill@bill-MS-7B79:~/db2Data/config$
Of course I did make changes mostly with the -v parameter….
I tried
- creating a local directory
- If I didn’t create it, the container did (at least where I had permission to)
- After creating those files. It would complain that it didn’t have permission to use those files
- If I didn’t create it, the container did (at least where I had permission to)
- creating a root directory entry
- changing the owner to me or db2inst1
- deleting the directory first
- adding user db2inst1
- changing the owner to db2inst1
various combos of the above
Here’s another attempt
bill@bill-MS-7B79:~/Docker$ docker run -h db2server --name db2server --restart=always --detach --privileged=true -p 50000:50000 --env-file .env_list -v /Docker:/database icr.io/db2_community/db2
b08043da8fb2fd7f75492f905965721cc8968378883773abda27e2caf09d484a
docker: Error response from daemon: Mounts denied:
The path /Docker is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences… -> Resources -> File Sharing.
See https://docs.docker.com/ for more info.
bill@bill-MS-7B79:~/Docker$
From Docker? Docker.com? You mean Docker Desktop? Above error message wrong. I assume…
Docker Desktop>Settings>Resources>File Sharing
I’ve gone on long enough!