Oracle 12c in Docker - oracle

For a while I'm searching for a good way to run Oracle in Docker. It was always ending up in huge images, and slow starting containers.
But today I saw the link: https://store.docker.com/images/oracle-database-enterprise-edition
Is this just an official Oracle12c we can use (I was able to pull and start it) or is this only for enterprise users?
Can I customize this image with my own .sql scripts? (With some entrypoint)?

You can follow the following steps:
docker login
docker pull store/oracle/database-enterprise:12.2.0.1
docker run -d -it --name oracledb12c -P store/oracle/database-enterprise:12.2.0.1
docker port containerID 1521/tcp (you will can connect to the datbase outside of the container using this port)
$ docker ps #check while the container status is not healthy)
Connect with sqlplus
docker exec -it containerID bash -c "source /home/oracle/.bashrc; sqlplus /nolog"
Connect with jdbc:
USER: sys PASSWD: Oradoc_db1
jdbc:oracle:thin:#(description=(address=(host=127.0.0.1)(protocol=tcp)(port=portNumner))
(connect_data=(service_name=ORCLPDB1.localdomain)))

Related

Can not show tables in sequel pro while they do exist according to docker container

I'm rather new at docker and i am currently having some trouble with my new laravel project
I started a new laravel project using laravel sail, which created a mysql container called organiser_mysql_1
I am able to view my database in my docker container, but when i try to use the same credentials on sequel pro, the database does not show.
docker container:
show databases
Sequel pro:
sequel pro credentials
sequel pro error
docker ps:
docker ps
env file:
env file
database.php
database.php
Command i used to get into docker container:
docker exec -it organiser_mysql_1 mysql -uroot -p
I can log into sequel pro without the Database: organiser, but the tables in my docker container are not in there.
You're probably connecting to to a MySQL server running directly on you host machine (Mac) and not to the one running in your docker container.
To verify:
lsof -i tcp:3306
There is a good chance it shows mysqld running on your Mac
To fix:
Or stop mysqld on your Mac or choose a free port (not 3306) in the next step
Map port 3306 in your container to a port on your Mac. You do this by adding FORWARD_DB_PORT=3307 (or other port) to you .env. This works because of this line.
Restart your containers by running sail stop && sail up -d

is there any way to run a docker image on host from other docker image? [duplicate]

I am using a docker container to build and deploy my software to a collection of ec2's. In the deployment script I build my software and then package it in a docker image. The image is pushed to my private registry, pulled by my production ec2's and then run. So essentially I will need to run docker within a docker container.
The problem is that I can't actually start docker on my container. If I try
service docker start
I get
bash: service: command not found
And if I try
docker -d
I get
2014/10/07 15:54:35 docker daemon: 0.11.1-dev 02d20af/0.11.1; execdriver: native; graphdriver:
[e2feb6f9] +job serveapi(unix:///var/run/docker.sock)
[e2feb6f9] +job initserver()
[e2feb6f9.initserver()] Creating server
2014/10/07 15:54:35 Listening for HTTP on unix (/var/run/docker.sock)
[error] attach_loopback.go:42 There are no more loopback device available.
loopback mounting failed
[e2feb6f9] -job initserver() = ERR (1)
2014/10/07 15:54:35 loopback mounting failed
The service command doesn't exist on the docker container so I can't start docker. I'm not sure what I should be doing now to start docker so I'm a bit stuck here, any help is appreciated.
A bit more information
Host machine is running fedora 20 (will eventually be running amazon linux on an ec2)
Docker container is running centos 7.0
Host is running Docker version 1.2.0, build fa7b24f/1.2.0
Container is running docker-0.11.1-22.el7.centos.x86_64
How about not running 'docker inside docker' and run docker on your host, but from within your docker container? Just mount your docker.sock and docker binary:
docker run -v /var/run/docker.sock:/run/docker.sock -v $(which docker):/bin/docker [your image]
https://github.com/sameersbn/docker-gitlab uses this approach to spin up docker containers, take a look at this image.
You can also take a look at: https://registry.hub.docker.com/u/mattgruter/doubledocker/
UPDATE on july 2016
The most current approach is to use docker:dind image, as described here:
https://hub.docker.com/_/docker/
Short summary:
$ docker run --privileged --name some-docker -d docker:dind
and then:
$ docker run --rm --link some-docker:docker docker info
While in almost all cases I would suggest following #cthulhu's answer and not running "docker in docker", in the cases when you must (e.g. a test suite which tests against multiple docker version), use the following to create additional loopback devices:
#!/bin/bash
for i in {0..6}
do
mknod -m0660 /dev/loop$i b 7 $i
done
(Taken from the thread for Docker Issue #7058)
You can simply run docker inside the docker container using dind. Try this image from Jerome, as follows:
docker run --privileged -t -i jpetazzo/dind
Check this page for more details:
https://github.com/jpetazzo/dind

Error while running postgres container "Error response from daemon: invalid mode: /var/lib/postgresql/data."

I'm trying to run a postgres docker container on Windows 10.
I've installed postgres using the Linux container as I couldn't do so using the Windows container.
While running the below in powershell
docker run -d --name pg-flowthru --env-file ./database/env.list -p 5432:5432 --rm -v ${PWD}:/docker/volumes/postgres:/var/lib/postgresql/data postgres
(env.list contains database credentials), I'm getting the below error:
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid mode: /var/lib/postgresql/data.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
C drive is already in the "Shared Drives" in Docker Desktop
I think this may be an issue with path, but I'm new to docker and can't figure it out.
From here
More info here
A volume has to be created first:
docker volume create postgresql-volume
The postgres container can now be run using the previously created volume:
docker run -d --name pg-flowthru --env-file ./database/env.list -p 5432:5432 -v 'postgresql-volume:/var/lib/postgresql/data' postgres
Listing the running containers now shows the above container running.

using psql to connect to postgres instance on Hasura created in Digital Ocean droplet

I have a Hasure GraphQL engine installed through a droplet installation on Digital Ocean.
Even though I gained root access to the droplet instance using ssh I can't connect to the instance inside Hasura droplet docker image.
What are the list of commands to run to connect to postgres instance inside docker image??
Once you sshed into your Digital Ocean instance, list all running docker containers:
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
....................................................
Take note of the CONTAINER ID of the container in question.
Then you can have a terminal session inside of the container, and use psql to connect to the database:
docker exec -it 05b3a3471f6f bash
root#a5sd22v5-# psql -U postgres
This SO question is more relevant.

Connecting to rethinkdb (or any other app running on an http port) from the Docker OS X beta

I've installed the Docker for Mac beta which allows you to use docker commands directly. I want to try to run rethinkdb through docker, so I've followed the instructions of the rethinkdb docker container docs and done the following:
docker run --name some-rethink -v "$PWD:/data" -d rethinkdb
This works, and I can see the container with docker ps and start shell with docker exec -it /bin/bash
However, I can't connect to the admin panel on my Mac directly with their suggestion
$BROWSER "http://$(docker inspect --format \
'{{ .NetworkSettings.IPAddress }}' some-rethink):8080"
This essentially amounts to google-chrome http://172.17.0.2:8080/, but this doesn't work. I asked around and was told
You can't use the docker private ip address space to access the ports
You have to forward them to the mac
However, I'm not sure how to do this as I don't have any port forwarding tools I'm familiar with such as ssh on the container itself. Using the suggested port forwarding command in the rethinkdb container docs ssh -fNTL ... but with localhost instead of remote does not work.
How can I connect to the rethinkdb admin panel through http with the docker beta on a Mac?
Try forwarding the container port using the -p flag in the docker run command, e.g.:
docker run -p 8080:8080 --name some-rethink -v "$PWD:/data" -d rethinkdb
and then it should be accessible on localhost,
google-chrome http://127.0.0.1:8080/
Relevant docker run docs: https://docs.docker.com/engine/reference/run/#/expose-incoming-ports

Resources