angoca/db2-docker

How to start?

Opened this issue · 9 comments

I'm trying to get a DB2 database up with your image from https://registry.hub.docker.com/u/angoca/db2-sample/.

The instructions say to start it with docker run, but that doesn't do anything, it's just bash. How do I get a database up and connect to it?

This is an image that has db2 installed, an instance has been created and the sample db was also created.

You can access the sample database by doing:

  • Changing the session to db2inst1 user
  • Starting the instance if it is not started: db2start
  • Connecting to the sample database: db2 connect to sample

If you want to have the interactive mode, you just type db2 (or db2 -t for sentences terminated by semi colon).

Please let me know if the image works correctly.

I tried the db2inst1 image, and have had no luck starting up db2 afterward. So I ran sudo docker run -i -t angoca/db2inst1 /bin/bash, and then tried to su - db2inst1, db2start. It throws an exception: SQL1042C An unexpected system error occurred. I tried googling that exception and one of the suggestions was to switch back to root and try to run db2iupdt. But that throws the same exception.

Have you tried in privilege mode? --privileged=true

sudo docker run -i -t --privileged=true --name="db2inst1" -p 50000:50000 angoca/db2inst1

Please check the other image documentation, in order to validate the environment: https://registry.hub.docker.com/u/angoca/db2-instance/

I did, but I needed to mount a volume as well: sudo docker run -i -t --privileged=true --name="db2inst1" -p 50000:50000 -v /db2:/home angoca/db2-instance. Thank you for your help!

i pull the angoca/db2-instance:lastest image ,and follow the steps as
https://hub.docker.com/r/angoca/db2-instance/ told.
now i want to manually create database,so i tried

 # docker run -it --privileged=true --name=db2 -p 50000:50000 -v /db2/home:/home angoca/db2-instance
 # ./createInstance  (in container)
 # sodu db2inst1
 $ db2

the forth command shows

db2: command not found' 

then i tried "db2start",it still shows "not found" error

am i missing something?

Hi Snecker,

In order to run db2 commands, it is necessary to have the db2profile. In your case, you change to the instance user without loading the profile. It lacked the dash option in the su command. The correct one is:

su - db2inst1

In any case, if the DB2 profile is not loaded, you can loaded manually by using the source command (or dot)

. ~db2inst1/sqllib/db2profile

Remember to put a whitespace after the dot.

For more details, you can check the test usage of this image in Travis-CI: https://travis-ci.org/angoca/db2-docker-travis/builds/130736866

@angoca

it works! thank you

When I use the db2-sample image on a local Docker (latest Mac build), I can start db2start fine (using all the advice in this thread). The docker instance stays up and running because it is associated with a pseudo terminal and a bash session that doesn't exit.

I'd like to export the docker image to dockercloud so that I can deploy and execute the DB2 server from my own node choice (here Softlayer).

I can load and deploy the docker image (for db2-sample) to my Softlayer docker node. I can start it.

However, I can't find a way to keep it running because, I believe, dockercloud does not support the pseudo-terminal connection. Therefore, the docker image terminates as soon as the dockercloud run session concludes.

Is there a way to start the database in the image (like db2start does) but with a process that does not daemonize itself and so never appears to terminate?

Rather than asking questions about how I think my goal may be reached, the direct question is, "how does one use this db2-sample docker image on dockercloud so that it stays up and running with a started db2 instance listening to port 50000?"

I have faced the same problem, and I have not found a solution for this. I have tried different strategies to have a open image (created from a Dockerfile) but none of them have worked.

At this time, I do not have any proposal to help you.