I’m trying to run db2 in a docker container, but when inspecting the logs I keep seeing
/bin/bash: db2: command not found
Command used:
> docker run -itd --name test-db2 --privileged=true -p 50080:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=abcd1234 -e DBNAME=TESTDB ibmcom/db2:latest
I went into the container’s terminal and ran:
> which db2
/usr/bin/which: no db2 in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
and found that it’s not added to the path for the root user, but it works when switching to the db2inst1 user:
> su - db2inst1
> which db2
~/sqllib/bin/db2
Note:
I haven’t tried to make my own Dockerfile starting from ibmcom/db2 because I’m a complete noob in docker.
Maybe I’m missing some steps, or maybe I’m doing something else wrong, because I’ve tried with 5 different versions of this image and I keep getting the same error.
Has anyone faced this problem?
Any help is appreciated! 🙏