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

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.

Related

Can't connect near-cli with near in local mode

I ran indexer in local mode as a docker container and also had a container with near-cli.
sudo docker run -it --name indexer --rm -v indexer_data:/near indexer run
sudo docker run --name near-cli --rm -it --volumes-from indexer:ro near-cli bash
Both are in the same network. All configured fine.
How can I make a request from near-cli container to the indexer? I try to do something like inside near-cli container:
NEAR_ENV=local NEAR_NODE_URL=http://indexer:3030 near create-account fomo.test.near --initialBalance 50 --masterAccount test.near --keyPath=/near/validator_key.json
but it doesn't work.
I found solution:
NEAR_ENV=local NEAR_CLI_LOCALNET_RPC_SERVER_URL=http://<ip-address>:3030 near create-account fomo.test.near --initialBalance 50 --masterAccount test.near --keyPath=/near/validator_key.json

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

freeswtich docker container connectivity

I am trying to run the docker container for freeswitch from the following URL
https://hub.docker.com/r/bettervoice/freeswitch-container/
When i issue the following command
CID=$(sudo docker run --name freeswitch -p 5060:5060/tcp -p 5060:5060/udp -p 5080:5080/tcp -p 5080:5080/udp -p 8021:8021/tcp -p 7443:7443/tcp -p 60535-65535:60535-65535/udp -v /home/ubuntu/freeswitch/conf:/usr/local/freeswitch/conf bettervoice/freeswitch-container:1.6.6)
After a while the following error is displayed
docker: Error response from daemon: driver failed programming external connectivity on endpoint freeswitch (d805c283f72bc75752a0eb354195e4c7b606b54fed604d238df826261ceeeb43): Error starting userland proxy:.
ERRO[0509] error waiting for container: context canceled
Please help.

Oracle 12c in Docker

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)))

Configuration issue in nginx of docker - Troubleshooting docker with no instaces

When there was a configuration problem and docker instance is not coming up, how to do the troubleshooting ..
RajRajen:lb4b-my rajrajen$ docker run -d -t -i -p 80:80 -p 443:443 --name my_nginx_v4 my_nginx_v4
f459a9d666f1596dd77c1095b7256075b183fe8b7997c17e8f7b1640606bb075
RajRajen:lb4b-my rajrajen$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
RajRajen:lb4b-my rajrajen$ docker ps
Results in NO Result. How to identify the reason for the failure. There are many links if there is a running instance.
docker exec -ti /bin/bash
Ref : https://askubuntu.com/questions/505506/how-to-get-bash-or-ssh-into-a-running-container-in-background-mode
Thanks
Just gave a try to find whats in
When there was a configuration problem and docker instance is not coming up, how to do the troubleshooting ..
RajRajen:lb4b-my rajrajen$ docker log
5139b2417a39563a3848cc796b6c572d6508c0b862c4d13dceac9d59b3936420
And this log message is available
RajRajen:lb4b-fe rajrajen$ docker logs 5139b2417a39563a3848cc796b6c572d6508c0b862c4d13dceac9d59b3936420
2015/11/27 01:11:58 [emerg] 1#1: unknown "redir_match" variable
nginx: [emerg] unknown "redir_match" variable
This hint helped to resolve the issue .
Thanks ...
Just gave a try to find whats in it.
When there was a configuration problem and docker instance is not coming up, how to do the troubleshooting ..
A) Identify the instance
RajRajen:lb4b-my rajrajen$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1a03bab01e40 lb4b-my "tail -f /dev/null" 7 minutes ago Excited(1) gc_lb4b-my
And this hidden container id helps to figure out further issue.
B) yet thats not enough to troubleshoot further issues inside the application
So, did the following to keep the docker running and then go inside the docker and execute the command that fails manually.
docker run -d -P --name gc_lb4b-my fe_lb4b-my tail -f /dev/null

Resources