Docker espeakbox: What do I do now? - docker

Seems real simple, but I'm not sure what to do now. I have docker on OSX and I'm want to try out espeakbox. So I ran
the command mentioned here.
to "run a container"
It's evidently running:
bash-3.2$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
705a605786c7 parente/espeakbox "/server" 34 seconds ago Up 33 seconds 0.0.0.0:8080->8080/tcp espeakbox
So, what do I do now, to use see it, hear it, etc.
Thanks.

There's full instructions on the GitHub page, so I'm loath to answer this question. However, I'm assuming the confusion is that you're not sure where the container is running. If you're using boot2docker, Just do:
$ curl http://$(boot2docker ip):8080/speech?text=hello
I assume it sends back an mp3 file.
Basically, the docker run command told Docker to forward port 8080 on the container to port 8080 on the host. When using boot2docker, the host is a Virtualbox VM, so we need to use the IP of the VM to connect to the service.

Related

Worldserver changing ports after docker-compose down & docker-compose up

I'm using AzerothCore with Docker.
I've noticed that after running docker-compose down and docker-compose up my worldserver and the database now uses different ports than the defaults. How to prevent this?
Note: the authserver port remained the same.
I use Windows 10 20H2 (Build 19042.844)
Normally docker creates automatically a tunnel on a random free port for any service that tries to bound on its own network.
However, unless you changed the WORLD_EXTERNAL_PORT or the port is already busy for some reason, the original port (together with the random one) should be open as well.
you can run the docker-compose ps or the docker ps to check which are network ports open.
Also, this behaviour changes based on your OS. Can you specify it in your first post, please?
thanks for the prompt reply, I haven't changed anything about WORLD_EXTERNAL_PORT, as for 'docker-compose ps' again my overwhelming inexperience comes out hehe, dont know where to enter the command, the 'docker ps' gives this result:

Windows 10 Docker Container Connection

I am trying to run docker on windows 10, installation worked fine. Now I am running few containers like below.
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7a86a28e4116 data-extractor_php-fpm "/usr/sbin/php-fpm7.…" About an hour ago Up 29 minutes 9000/tcp data-extractor-php-fpm
09105815a3c4 nginx:alpine "nginx -g 'daemon of…" About an hour ago Up 29 minutes 0.0.0.0:6000->80/tcp data-extractor-webserver
The nginx container is running, But may I know, how to connect to this container from browser,
normally on mac it works like below
http://localhost:6000/
May I know how to access this container in wondows 10?
Yes, found the answer by myself. It appears to be chrome issue, chrome refusing to connect to port 6000 throwing error like unsafe port, either change settings in browser or update compose file to use allowed ports by chrome, and second step will be to update hosts file map docker machine ip to localhost. Docker ip can tracable by using following command.
ipconfig
hope it helps others.

SSH into docker containers in rhel

I have a Server which has RHEL OS. I am creating a docker container inside the Server with the RHEL image as well.
My goal is to login to the docker container with a separate IP address as it was a VM.
So if the IP of the Server is 192.168.1.10 and the IP of the container inside the server is 192.168.1.15, I want to log in to both 192.168.1.10 and 192.168.1.15 as it was a separate VM. How can I achieve that?
Thanks for your help in advance.
Short answer: you’ll need to start the container running sshd. It could be as simple as adding /usr/sbin/sshd to the run command.
Longer answer: this is not really the way docker is supposed to be used. What you probably really want is a fully functional system, with sshd started via systemd. This is a multi process fat container, and generally not considered a best practice.
Options are
Use docker exec command
Use docker attach command
Start/setup sshd inside the container itself [not recommended though].
Below link details this process nicely:
https://phoenixnap.com/kb/how-to-ssh-into-docker-container
Note: This isn't my link. I found it via browsing internet.

localhost not working docker windows 10

I am using VS2017 docker support. VS created DockerFile for me and when I build docker-compose file, it creates the container and runs the app on 172.x.x.x IP address. But I want to run my application on localhost.
I did many things but nothing worked. Followed the docker docs as a starter and building microsoft sample app . The second link is working perfectly but I get HTTP Error 404 when tried the first link approach.
Any help is appreciated.
Most likely a different application already runs at port 80. You'll have to forward your web site to a different port, eg:
docker run -d -p 5000:80 --name myapp myasp
And point your browser to http://localhost:5000.
When you start a container you specify which inner ports will be exposed as ports on the host through the -p option. -p 80:80 exposes the inner port 80 used by web sites to the host's port 80.
Docker won't complain though if another application already listens at port 80, like IIS, another web application or any tool with a web interface that runs on 80 by default.
The solution is to:
Make sure nothing else runs on port 80 or
Forward to a different port.
Forwarding to a different port is a lot easier.
To ensure that you can connect to a port, use the telnet command, eg :
telnet localhost 5000
If you get a blank window immediatelly, it means a server is up and running on this port. If you get a message and timeout after a while, it means nobody is running. You anc use this both to check for free ports and ensure you can connect to your container web app.
PS I run into this just a week ago, as I was trying to set up a SQL Server container for tests. I run 1 default and 2 named instances already, and docker didn't complain at all when I tried to create the container. Took me a while to realize what was wrong.
In order to access the example posted on Docker Docs, that you pointed out as not working, follow the below steps,
1 - List all the running docker containers
docker ps -a
After you run this command you should be able to view all your docker containers that are currently running and you should see a container with the name webserver listed there, if you have followed the docker docs example correctly.
2 - Get the IP address where your webserver container is running. To do that run the following command.
docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" webserver
You should now get the IP address which the webserver container is running, hope you are familiar with this step as it was even available within the building Microsoft sample app example that you attached with the question.
Access the IP address you get once running the above command and you should see the desired output.
Answering to your first question (accessing docker container with localhost in docker for windows), in Windows host you cannot access the container with localhost due to a limitation in the default NAT network stack. A more detailed explanation for this issue can be obtained by visiting this link. Seems like the docker documentation is not yet updated but this issue only exists in Windows hosts.
There is an issue reported for this as well - Follow this link to see that.
Hope this helps you out.
EDIT
The solution for this issue seems to be coming in a future Windows release. Yet that release comes out this limitation is available in Windows host. Follow this link -> https://github.com/MicrosoftDocs/Virtualization-Documentation/issues/181
For those who encountering this issue in 2022, changing localhost to 127.0.0.1 solved an issue for me.
There is other problem too
You must have correct order with parameters
This is WRONG
docker run container:latest -p 5001:80
This sequence start container but parameter -p is ignore, therefore container have no ports mapping
This is good
docker run -p 5001:80 container:latest

Port binding is not working in docker on windows

I have installed docker on my Windows m/c.
I am trying to install Gerrit on that.
Pull image is done-Successfully
Run image is also done -->
docker run -d -p 8080:8080 -p 29418:29418 ******/gerrit
I try to connect it through browser with my container id:8080 but it throws error
This site can’t be reached
What is oing wrong.. Please help with suggestions.
BR,
Rash
You need to access your container by IP of virtual machine. You can obtain it with command: docker-machine ls. Then access container in browser by (replace ip) http://192.168.99.100:8080
This is a known limitation of windows containers at the moment as per the docker documentation (https://docs.docker.com/docker-for-windows/troubleshoot/#limitations-of-windows-containers-for-localhost-and-published-ports).
As of Windows 10 Creator's update this has kinda been fixed where you can use host IP with the bounded host port(http://<hostIp>:<hostBoundedPort>), but still not localhost or any of it's aliases.
Alternatively you can avoid port mapping hit the container IP directly. There is numerous ways to get your container IP. Personally I would use:
docker ps
This lists out all the the running docker containers allowing you to find the Container ID for the container that you want to hit followed by:
docker inspect <initial_part_or_full_id>
This will output low level information about the container, including it's Network settings where you will find the NAT-ed endpoint details containing the IP. Then simply http://<containerIP>:<containerPort>.

Resources