Where is the pulled Docker image configuration file - docker

I pulled
docker pull dylanmei/zeppelin:latest
docker run --name zeppelin -p 8080:8080 -p 8081:8081 dymanmei/zeppelin:latest
If I want to change the port of the zeppelin web-site, where do I find the zeppelin configure files?
d91ecdff6a24 dylanmei/zeppelin:latest
"bin/zeppelin.sh" 26 seconds ago Up 26 seconds
0.0.0.0:8088-8089->8088-8089/tcp zeppelin
This is my docker ps -a information. Where is the Docker configuration file of zeppelin?

Zeppelin's configuration is somewhere within the image that you downloaded. However, your question asks how you may configure the port(s) on which Zeppelin is accessed and, using the container, this is straightforward.
The docker run ... command that you included defines 2 ports mappings. These are defined with the flags-p 8080:8080 and -p 8081:8081.. These define that your host's port 8080 is mapped to the container's port 8080 and your host's port 8081 to the container's port 8081.
Rather then change the ports used by the container (and configured within it), you may simple change these port mappings when you run the container.
For example, if you use -p 8888:8080, the container's port 8080 (unchanged) would now be available on your host's port 8888 (instead of 8080).
This has the effect you wanted of changing the port.

Related

how to publish a docker container port to one of the random available port in the host

I tried to do the following:
docker run --expose 8765 --publish-all -it nginx
But this also exposes 80 along with port 8765
[root#centos7]# docker port f4b608998815
80/tcp -> 0.0.0.0:49156
80/tcp -> :::49156
8765/tcp -> 0.0.0.0:49155
8765/tcp -> :::49155
How to publish port 8765 to one of the random available ports in the host without specifying where to?
The nginx base image already declares EXPOSE 80 and there's no way to un-expose a port, so if you use the docker run -P or --publish-all option to publish every exposed port, it will always be published alongside your manually-exposed port.
You can use the lowercase docker run -p option with only a single port number to publish that port on an arbitrary host port instead:
docker run -p 8765 -d nginx
Since Docker containers internally won't have port conflicts with each other, you may want to just use the default HTTP port 80, matching the standard Nginx config. The --expose --publish-all combination is pretty much the only actual effect of docker run --expose, and you can get the same thing with --port; you pretty much never need the docker run --expose option.

I cannot access proxy of a running docker container

I have a running Docker container which shows PORTS 9191/tcp. So on my browser, I tried accessing server using localhost:9191/api/.... However, browser throws an error This site can’t be reached
Here is a log to docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c214aefed15e shah "youtube-dl-server -…" 6 seconds ago Up 5 seconds 9191/tcp boring_swirles
This is what my docker file looks like
FROM mariozig/youtube-dl_server
RUN pip install --pre youtube_dl_server
EXPOSE 9191
ENTRYPOINT ["youtube-dl-server", "--host=0.0.0.0"]
You have not mapped the docker container port to host port.
The docker container runs on a host. And The host doesn't know which requests to be directed to the docker container. For that you have to to map the host port to docker container port using -p flag in docker run command as shown below:
docker run -d -p HOST_PORT:CONTAINER_PORT IMAGE_NAME
-p in this command will specify that you are forwarding your host port to the container port. In your local host in the port HOST_PORT will call the port CONTAINER_PORT of your container.
Now when you will access the HOST_IP:HOST_PORT then the host will redirect the request to corresponding container with which this HOST_PORT has been mapped.
For example I started a tomcat docker container and mapped the tomcat container's 8080 port to host's 9092 port by using the above command. When I do docker ps I can see the mapping under PORTS as 0.0.0.0:9092->8080/tcp

Two docker's container see each others in the same machine

I create an Docker's image with name is sample, then I installed nginx on both of them that listen to port 80 and it shows simple index.html.
then I use below commands to run contianers:
docker run -it -p 80:80 --name sample1 sample
docker run -it -p 81:80 --name sample2 sample
and I successfully see the index.html from main OS from two containers, but when I go inside container sample1 I couldn't see the index.html of sample2 and It does not work conversely either.
The -p option is the shortform for ports. When you do -p you are binding the container's port 80 to its host's port 80.
So container sample1 and sample2 are just merely binding their respective port 80 to the host's port 80 and 81, hence there is no direct linkage between them.
To make the containers visible to each other, first you will have to use the --link option and then do an --expose to allow the containers to see each other through the exposed port.
Example:
docker run -it -p 80:80 --name sample1 sample
docker run -it -p 81:80 --link=sample1 --expose="80" --name sample2 sample
Essentially --link means to allow the container to see the link value's container
--expose means the linked containers are able to communicate through that expose port.
Note: linking the containers is not sufficient, you need to expose ports for them to communicate.
You might want refer to the docker-compose documentation for more details;
https://docs.docker.com/compose/compose-file/
While the documentation is for docker-compose but the options are pretty much the same as the raw docker binary, and everything is nicely put on 1 page. That's why I prefer looking at there.
In Docker you can bind container's port to docker machine (Machine installed with docker) port using
docker run -it -p 80:80 image
Then you can use docker machine Ip and port inside the another container.

Access apache inside ubuntu container

I have apache installed inside a running ubuntu:14.04 container. How to access this in the browser of the host machine? The address showing inside the container is, 172.17.0.2. Please help.
By default, the apache httpd image exposes the port 80
docker run -it --rm --name my-apache-app -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4
So http://localhost should be enough.
In your case, make sure:
the httpd is actually running (docker exec -it <yourContainer> bash: ps -eaf),
you have mapped the port you are running Apache in your container to the host (-p 80:80 for instance).
By default, the apache image exposes the port 80, but you need config this in run command (-p):
docker run -d -p 80:80 httpd
The first number is port of Docker Host and the second one is port of container. This configuration will map all connections to port tcp 80 of docker host to the same port of container.
After that you can access your application in your browser, using 127.0.0.1, localhost or other IP Address of your interface.

How to assign as static port to a container?

I want to assign a container a port, so that it gets the same port after every restart of the container.
Example:
I have a container, which has an Apache in it. The Apache runs on port 80 inside the container.
Now, after starting the container, docker assigns a host port to the container port, for example: 49154 -> 80. But the host port changes after restart, depending on the number of running containers. I tried to specify the port in the config.json file of the container, but it gets overwritten.
Is it possible to specify the host port manually?
Thanks in advance and best regards,
Chris
Per the docker.io documentation: https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/
$ sudo docker run -p 80:80 <image> <cmd>
Default port redirects can be built into a container with the EXPOSE build command.
When you start docker, you can use the '-p' parameter.
docker run -p 80 yourimage apache2 will do what you currently have.
Now, you can specify ':' to make this port static:
docker run -p :80 -p :443 yourimage apache2
If you are using a Dockerfile with the EXPOSE instruction, it is the same thing :)

Resources