I have Jenkins installed in Docker container by the following guideline
https://www.jenkins.io/doc/book/installing/docker/
I am also trying to install Selenoid image in Jenkins using the pipeline
pipeline {
agent any
stages {
stage('Prepare Selenoid') {
steps {
sh 'wget "https://github.com/aerokube/cm/releases/download/1.8.2/cm_linux_amd64"'
sh 'chmod +x cm_linux_amd64'
sh './cm_linux_amd64 selenoid start –vnc'
sh 'docker ps'
sh 'docker logs selenoid'
sh 'curl http://localhost:4444/status'
}
}
}
post {
always {
script {
sh 'docker stop selenoid'
sh 'docker rm selenoid'
}
}
}
}
When I run this job, I got the following logs:
...
> Starting Selenoid...
> Successfully started Selenoid
+ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99467c57d5c6 aerokube/selenoid:1.10.9 "/usr/bin/selenoid -…" 2 seconds ago Up Less than a second 0.0.0.0:4444->4444/tcp selenoid
+ docker logs selenoid
2023/01/13 17:09:45 [-] [INIT] [Loading configuration files...]
2023/01/13 17:09:45 [-] [INIT] [Loaded configuration from /etc/selenoid/browsers.json]
2023/01/13 17:09:45 [-] [INIT] [Video Dir: /opt/selenoid/video]
2023/01/13 17:09:45 [-] [INIT] [Logs Dir: /opt/selenoid/logs]
2023/01/13 17:09:45 [-] [INIT] [Using Docker API version: 1.41]
2023/01/13 17:09:45 [-] [INIT] [Timezone: UTC]
2023/01/13 17:09:45 [-] [INIT] [Listening on :4444]
+ curl http://localhost:4444/status
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (7) Failed to connect to localhost port 4444: Connection refused
script returned exit code 7+
...
I also tried different options:
0.0.0.0:4444/status
127.0.0.1:4444/status
Your pipeline code is probably also running in another container. So localhost inside this container is not the localhost of the host machine you are expecting to access. Try to use http://selenoid:4444/, but make sure your container is running in selenoid network being used by CM tool by default.
Related
DDEV-Local version v1.13.1
commit v1.13.1
db drud/ddev-dbserver-mariadb-10.2:v1.13.0
dba phpmyadmin/phpmyadmin:5
ddev-ssh-agent drud/ddev-ssh-agent:v1.13.0
docker 19.03.8
docker-compose 1.25.0-rc4
os linux
router drud/ddev-router:v1.13.0
web drud/ddev-webserver:v1.13.1
Composer version 1.9.3 2020-02-04 12:58:49
Starting d8views...
Building ddev-ssh-agent
Creating ddev-ssh-agent ... done
ssh-agent container is running: If you want to add authentication to the ssh-agent container, run 'ddev auth ssh' to enable your keys.
Pushing mkcert rootca certs to ddev-global-cache
Pushed mkcert rootca certs to ddev-global-cache
Running Command=ip address show dev docker0
ddev needs to add an entry to your hostfile.
It will require administrative privileges via the sudo command, so you may be required
to enter your password for sudo. ddev is about to issue the command:
sudo /home/linuxbrew/.linuxbrew/Cellar/ddev/1.13.1/bin/ddev hostname d8views.ddev.site 127.0.0.1
Please enter your password if prompted.
Running Command=sudo /home/linuxbrew/.linuxbrew/Cellar/ddev/1.13.1/bin/ddev hostname d8views.ddev.site 127.0.0.1
[sudo] password for james:
Building db
Building web
Creating ddev-d8views-db ... done
Creating ddev-d8views-dba ... done
Creating ddev-d8views-web ... done
Creating ddev-router ... done
Failed to start d8views: ddev-router failed to become ready: logOutput=nginx config: OK nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused
ddev-router healthcheck endpoint not responding
, err=container /ddev-router unhealthy: nginx config: OK nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused
ddev-router healthcheck endpoint not responding
So I ran ddev describe to see what's what:
ddev describe
NAME TYPE LOCATION URL STATUS
d8views drupal8 ~/Projects/d8views https://d8views.ddev.site running
Project Information
-------------------
PHP version: 7.3
MariaDB version
MySQL version
URLs
----
http://d8views.ddev.site
http://127.0.0.1:32786
https://d8views.ddev.site
https://127.0.0.1:32785
MySQL/MariaDB Credentials
-------------------------
Username: "db", Password: "db", Default database: "db"
or use root credentials when needed: Username: "root", Password: "root"
Database hostname and port INSIDE container: db:3306
To connect to db server inside container or in project settings files:
mysql --host=db --user=db --password=db --database=db
Database hostname and port from HOST: 127.0.0.1:32784
To connect to mysql from your host machine,
mysql --host=127.0.0.1 --port=32784 --user=db --password=db --database=db
Other Services
--------------
MailHog: http://d8views.ddev.site:8025
phpMyAdmin: http://d8views.ddev.site:8036
DDEV ROUTER STATUS: healthy
ssh-auth status: healthy
I have ddev on another laptop that runs fine but all of the versions are older, is something missing here on this setup? I noticed that I have to provide a password during the initial ddev start process.
I have an ansible playbook as follows (with irrelevant info stripped):
tasks:
- name: get public_ip4 output
shell: curl http://169.254.169.254/latest/meta-data/public-ipv4
register: public_ip4
- debug: var=public_ipv4.stdout
- name: Create docker_pull
template: <SNIP>
- name: Pull containers
command: "sh /root/pull_agent.sh"
- name: (re)-create the agent
docker_container:
name: agent
image: registry.gitlab.com/project_agent
state: started
exposed_ports: 8889
published_ports: 8889:8889
recreate: yes
env:
host_machine: public_ipv4.stdout
The target machine is an AWS EC2 instance. The purpose is to get its public IPv4 address and give it as an environment variable to a container. The container has a Python instance, Agent, that will use os.environ.get(host_machine) to thus access the IPv4 address of the EC2 instance.
The output from the debug logs is (with irrelevant info removed and the ipv4 address replaced with ):
PLAY [swarm_manager_main] ******************************************************
TASK [get public_ip4 output] ***************************************************
[WARNING]: Consider using the get_url or uri module rather than running
'curl'. If you need to use command because get_url or uri is insufficient you
can add 'warn: false' to this command task or set 'command_warnings=False' in
ansible.cfg to get rid of this message.
changed: [tm001.stackl.io] => {"changed": true, "cmd": "curl http://169.254.169.254/latest/meta-data/public-ipv4", "delta": "0:00:00.013260", "end": "2019-08-02 08:36:26.649844", "rc": 0, "start": "2019-08-02 08:36:26.636584", "stderr": " % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 12 100 12 0 0 2600 0 --:--:-- --:--:-- --:--:-- 3000", "stderr_lines": [" % Total % Received % Xferd Average Speed Time Time Time Current", " Dload Upload Total Spent Left Speed", "", " 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0", "100 12 100 12 0 0 2600 0 --:--:-- --:--:-- --:--:-- 3000"], "stdout": "<HIDDEN>", "stdout_lines": ["52.210.80.33"]}
TASK [debug] *******************************************************************
ok: [tm001.stackl.io] => {
"public_ipv4.stdout": "VARIABLE IS NOT DEFINED!: 'public_ipv4' is undefined"
}
TASK [Create docker_pull] ******************************************************
<SNIP>
TASK [Pull containers] *********************************************************
<SNIP>
TASK [(re)-create the agent] ********************************************
changed: <SNIP> ["host_machine=public_ipv4.stdout", <SNIP>
I don't understand why the public_ipv4 variable is not used correctly. I've tried multiple things (including setting set_fact or setting a new variable) but to no avail.
What am I doing wrong?
There is a typo in your playbook: ip4 and ipv4
register: public_ip4
debug: var=public_ipv4.stdout
I'm quite new to Docker and Apache-Superset and trying to run a container (using docker) from the container image. Loaded the .tar file with
docker load --input ./inc_superset.tar
Which went as expected, tried running the container from this image file with
docker run --cidfile ./cid.txt <IMAGE_ID>
This starts my container but is has unhealthy status; upon inspecting the container ( with docker inspect) I get a huge JSON, below is a snippet of the log received (can post the entire log on request).
"Health": {
"Status": "unhealthy",
"FailingStreak": 5,
"Log": [
{
"Start": "2019-01-22T19:59:00.8036984+05:30",
"End": "2019-01-22T19:59:01.5698797+05:30",
"ExitCode": 7,
"Output": " % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 8088: Connection refused\n"
},
...
...
{
"Start": "2019-01-22T20:01:02.589517677+05:30",
"End": "2019-01-22T20:01:02.794486003+05:30",
"ExitCode": 7,
"Output": " % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 8088: Connection refused\n"
}
]
}
Am I making any mistake? Am I missing something? Any troubleshooting help on this requested.
Thanks
The problem was the webserver within the superset container doesn't run by default as of the configuration available on apache.org as of 7 September 2019.
Solved it as follows:
#Go into the container
docker-compose exec superset bash
#Start the webserver that is exposed on all interfaces so that we can access it from docker host
superset run -p 8088 --host 0.0.0.0
I was facing the same issue. Ran via docker-compose using the instructions on https://superset.incubator.apache.org/installation.html but get no response from localhost:8088.
Docker inspect State.Health.Status = "unhealthy" and log show several entries with curl: (7) Failed to connect to localhost port 8088: Connection refused\n"
docker ps shows that the container is exposed on 0.0.0.0:8088
I have a docker swarm running on 2 nodes created via Oracle VirtualBox installed on CentOS 7. I am able to deploy a stack running 6 containers equally distributed over the two machines.
However, I am unable to connect to the deployed application with ports exposed.
Here's the content of my Docker Compose File
version: "3"
services:
web:
image: <myusername>/friendlyhello:latest
deploy:
replicas: 6
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "80:80"
networks:
- webnet
networks:
webnet:
Here is the output of docker-machine ls:
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
myvm1 * virtualbox Running tcp://192.168.99.100:2376 v18.09.0
myvm2 - virtualbox Running tcp://192.168.99.101:2376 v18.09.0
Here is the error from my curl command
curl http://192.168.99.100/
curl: (7) Failed connect to 192.168.99.100:80; Connection refused
Even though my application seems to be running fine.
docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
i5nw2wcir9j3 getstartedlab_web replicated 6/6 harmanspall/friendlyhello:latest *:80->80/tcp
docker service ps getstartedlab_web
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
dn7mrfo1yvg4 getstartedlab_web.1 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
jxkr1psbvmpc getstartedlab_web.2 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
jttd4t6b9gz5 getstartedlab_web.3 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
zhs0c7ygj8cs getstartedlab_web.4 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
mx6gykk3qocd getstartedlab_web.5 harmanspall/friendlyhello:latest myvm1 Running Running 28 minutes ago
pku7f60ij0bq getstartedlab_web.6 harmanspall/friendlyhello:latest myvm2 Running Running 28 minutes ago
My Docker network list, as seen from Swarm Manager:
NETWORK ID NAME DRIVER SCOPE
5c502a957a70 bridge bridge local
a3b1f749c09f docker_gwbridge bridge local
80nens8mmp6i getstartedlab_webnet overlay swarm
c9647a0f6c30 host host local
mj60zgzhiwjf ingress overlay swarm
5adba823ce78 none null local
Any pointers would be appreciated.
~~ EDIT ~~
This does not seem to be an issue with connectivity to VMs since I am able to ping my Virtualbox
ping 192.168.99.100 -c 5
PING 192.168.99.100 (192.168.99.100) 56(84) bytes of data.
64 bytes from 192.168.99.100: icmp_seq=1 ttl=64 time=0.246 ms
64 bytes from 192.168.99.100: icmp_seq=2 ttl=64 time=0.215 ms
64 bytes from 192.168.99.100: icmp_seq=3 ttl=64 time=0.226 ms
64 bytes from 192.168.99.100: icmp_seq=4 ttl=64 time=0.251 ms
64 bytes from 192.168.99.100: icmp_seq=5 ttl=64 time=0.262 ms
--- 192.168.99.100 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.215/0.240/0.262/0.017 ms
It also fails when I try curl from inside the VM
docker-machine ssh myvm1 "curl http://192.168.99.100/"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 192.168.99.100 port 80: Connection refused
exit status 7
docker-machine ssh myvm1 "curl http://localhost/"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
exit status 7
I am trying to run following command in my dockerfile for downloading pandas package
RUN curl -x proxy.temp.com:8080 -U myid_9076:pwd123* -L -O https://files.pythonhosted.org/packages/b4/31/bbd2c915aad67c7cb572b7c6ca8f645fcb112064ef6774436d4f65acd5a1/pandas-0.20.3-cp27-cp27m-manylinux1_x86_64.whl
But I get following error while building docker-image using same dockerfile:
---> Running in c8ddcdcdb155
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0curl: (7) Failed to connect to proxy.temp.com port 8080: No route to host
Same command runs and downloads package on bare metal node on which docker is installed. But while building docker-image it gives above error. What is the issue, how can I download this package required for my image?
Also tried setting environment variables in my dockerfile before downloading pandas package as below,
ENV http_proxy 'http://myid_9076:pwd123*#proxy.temp.com:8080/'
ENV https_proxy 'http://myid_9076:pwd123*#proxy.temp.com:8080/'
but same error is seen in this case too.
It was network conflict issue, my network was conflicting with docker network. So I have set parameter "bip" in /etc/docker/daemon.json as shown below
{
"bip" : "12.12.0.1/24"
}
Got the answer from link Unable to access local network IP from docker container