How to access docker mediawiki from another machine on the network? - linux

I'm a complete newcomer to docker (and also a Linux novice). I've just installed docker and mediawiki on a Lubuntu 16.10 VM running on an ESXi 6.5 host. I followed guidance here
https://github.com/addshore/mediawiki-docker-dev
I have mediawiki up and running on the Lubuntu VM, and can access it using:
http://default.web.mw.localhost:8080
I'd like to access mediawiki from another machine on the LAN, but don't know where to start. I've tried this command:
sudo docker run -d -p 8080:8080 apache
but got this error:
Unable to find image 'apache:latest' locally
docker: Error response from daemon: pull access denied for apache, repository does not exist or may require 'docker login'.
Is there a simple way of getting access to my docker/mediawiki site from another machine?

As the error says... apache is not an image name
MediaWiki has an official docker image... And you should not use sudo to run containers
docker run --name some-mediawiki -p 8080:80 -d mediawiki

Related

Unable to launch the Jenkins console which is running on Linux box

I just pulled the Jenkins image from docker hub by using below command.
sudo docker pull jenkins
sudo docker run -p 7071:7071 -p 50000:50000 jenkins this command help me to run the jenkins image inside the docker container
Now the problem is that I just want to run the Jenkins console to create a some sample test jobs. When I tried to access this from some windows machine I'm not able to connect and It returned 404 error code.
Tried to connect the Jenkins from Windows machine.
http://<ip address>:7071 -> this is failing to connect.
http://<ip address>:50000 -> This returning the Jenkins Agent Protocol details
Output:
Jenkins-Agent-Protocols: JNLP-connect, JNLP2-connect, JNLP4-connect,
Ping Jenkins-Version: 2.60.3 Jenkins-Session: cba34bd8 Client:
XXXXXXXX Server: YYYYYYYY
Can someone help me since I'm new to docker + jenkins world and want to know how to connect the dockerized jenkins that is hosted in the Linux box.
Thanks in advance.
The main port used by Jenkins for access via the web console is 8080 and so add:
docker run ... -p 8080:8080

How to pull a docker image from Azure Registry in a Azure Ubuntu virtual machine

I have created an Azure Registry where I deploy some docker container from the CD\CI in Azure DevOps.
Following the Microsoft documentation, I have created a service principal. So, I have username and password to use to pull images from the Azure Container Registry. I tried to pull the images locally and it is working. To connect to the Container registry I use this command:
docker login myazureregistry.azurecr.io --username --password
Now, I want to create a virtual machine in Azure to publicly access to the application in the container.
I created an Ubuntu virtual machine and installed Docker. I run the same command as before on the Ubuntu machine but I got an error:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.39/auth: dial unix /var/run/docker.sock: connect: permission denied
What is the problem? How have I to configure Ubuntu to connect to the Azure Container?
Maybe you don't have permissions for use docker.
Add your user to docker group for use docker command without sudo
sudo groupadd docker
sudo usermod -aG docker $USER
And after this run your login command. (If you use virtual machine, it may be necessary to restart the virtual machine for changes to take effect)

Running Splash on Docker Toolbox with Windows 10

I am trying to install and run splash on using Windows 10 Home. I have installed docker toolbox, as on windows 10 Home you can't install docker. Then in command prompt when I type
docker pull scrapinghub/splash
I get the error
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/images/create?fromImage=scrapinghub%2Fsplash&tag=latest: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
One interesting thing I noticed was that if I run Docker Quickstart Terminal I can install splash with the command
docker pull scrapinghub/splash
and then using the command
docker run -p 5023:5023 -p 8050:8050 -p 8051:8051 scrapinghub/splash
it gives me
server listening on http://0.0.0.0:8050
But then when I paste http://0.0.0.0:8050 into Chrome it gives me "This site can't be reached."
Thanks
So 1st error clearly says that your Docker container is not running, so your pull command fails
You can check by running any docker command maybe try this
docker --version
For your 2nd query, you need to use Docker IP, to access the application
You can try docker-machine ip to see, on what IP docker is running (Assuming docker-machine is installed)
Generally, on windows Docker IP is 192.168.99.100
Try these 2
192.168.99.100:8050
or
localhost:8050

Escaping Docker Container

I have installed a Docker on my Ubuntu machine 16.04.
Is there any way to bypass Docker container to host? (RCE, Privilege Escalation etc..) Which means is there any way to access the host machine inside the docker container.
Below is the command which I am using it to launch the container.
docker run --rm -ti ubuntu:16.04
I am going to give docker containers access in my college for testing purpose. And, I have hosted everything on my personal cloud. Is it possible to compromise the host machine from the container?
Please let me know about this. Before I start giving access in my college I need to make sure about it.
PS: I have configured macvlan and containers cannot talk to each other.
Thanks!!

How to forward eclipse in a docker container through a linux proxy?

I have an Eclipse instance running on linux Ubuntu in a docker container. This container runs on a CentOS host with no physical display and I would like to forward X11 from the docker container to my laptop (running windows) through the CentOS host.
Docker container runs with
docker run --name docker-eclipse -p 5000:5000/tcp -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix
While I can forward X11 from the host to my laptp with no problems, I'm not able to start eclipse inside the container, because it dies with "Cannot open display:".
What I'd like is
laptop --> remote host --> docker container running eclipse
What is the best way to do that?
This might work (server is assumed to be the remote host running Docker, laptop is assumed to be the local host from which you want the GUI):
Connect to the server.
Mount through sshfs the laptop's .X11 socket from the server: user#server:$sshfs laptop:/tmp/.X11-unix /tmp/.X11-unix.
Start the container with something like user#laptop:ssh -X server docker run --name docker-eclipse -p 5000:5000/tcp -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix.
I'm not sure this would work, and it does not feel the cleanest way of doing so, but what you want to perform is quite.... unusual (though it would be something really great !!).
Comment your feedback !

Resources