Showing posts with label docker. Show all posts
Showing posts with label docker. Show all posts

August 24, 2021

[SOLVED] local gitlab-runner exec docker with custom cntainer registry

 

In case your .gitlab-ci.yaml file has reference for custom docker registry and you get an error

ERROR: Preparation failed: failed to pull image "registry.example.io/foo/dev-base:22.0.2" with specified policies [always]: Error response from daemon: Get https://registry.example.io/v2/foo/dev-base/manifests/0.0.2: denied: access forbidden (manager.go:205:0s)



try to pass your auth key from ~/.docker/config.json file as follows. where AUTH_KEY is the key form this file for your domain 


gitlab-runner exec docker deploy:foo --env DOCKER_AUTH_CONFIG="{\"auths\":{\"registry.example.io\":{\"auth\":\"AUTH_KEY\"}}}"

November 22, 2017

[SOLVED][gitlab-ci-multirunner] Cannot connect to the Docker daemon at unix:///var/run/docker.sock




Two errors you can fix like that

#1 set privileged = true

2017-11-21T15:17:26.802822881Z mount: permission denied (are you root?)
2017-11-21T15:17:26.803090353Z Could not mount /sys/kernel/security.
2017-11-21T15:17:26.803107368Z AppArmor detection and --privileged mode might break.
2017-11-21T15:17:26.806984781Z mount: permission denied (are you root?)


#2 Mount /var/run/docker.sock as a volume

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?




/etc/gitlab-runner/config.toml


concurrent = 4
check_interval = 0

[[runners]]
  limit = 4
  name = "fancy name"
  url = "https://www.gitlab.com"
  token = "secret token"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "alpine:3.4"
    privileged = true
    disable_cache = false
    volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"]
  [runners.cache]
    Insecure = false

November 21, 2017

[SOLVED]"[: 1: [: Syntax error: end of file unexpected"



If you getting
"[: 1: [: Syntax error: end of file unexpected" 
in gitlab while executing jobs in under .gitlab-ci.yml
check if your entrypoint.sh of the Docker image you using in this job.


Wrong:
exec $@


Right:
exec "$@"


Source: https://docs.docker.com/engine/reference/builder/#exec-form-entrypoint-example

February 18, 2017

[SOLVED]Error response status: 6 Selenium error: no such session (Chrome selenium tests on gitlab runner)

Selenium tests with chrome on gitlab gave me this error "Error response status: 6 Selenium error: no such session". I order to fix it

Install virtual display
apt-get install -qq -y xvfb

#try to fool google-chrome to run without sandbox
mv /usr/bin/google-chrome /usr/bin/google-chrome-orig \
    && echo '#!/bin/bash' > /usr/bin/google-chrome \
    && echo '/usr/bin/google-chrome-orig --no-sandbox --disable-setuid-sandbox --allow-sandbox-debugging "$@"' >> /usr/bin/google-chrome  \
    && chmod +x /usr/bin/google-chrome

Before starting your test start virtual display
Xvfb :0 -ac +extension RANDR -screen 0 1366x768x24 &

than run your test in
xvfb-run polymer test -l chrome

Make your own or use my docker image
https://hub.docker.com/r/printminion/polymer-tester/

Example dockerfile: https://github.com/printminion/polymer-tester/blob/master/Dockerfile


Error:
(node:4444) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
Installing and starting Selenium server for local browsers
Selenium server running on port 38917
Web server running on port 2000 and serving from /builds/printminion-group/canvas-editor-base
chrome 56                Tests failed: {"message":"[get(\"http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0\")] Error response status: 6 Selenium error: no such session\n  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 38 milliseconds\nBuild info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'\nSystem i...
Test run ended in failure: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c

chrome 56 (error)                    

Error: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c

error:   cli runtime exception: Error: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c
error:   Error: Error: [get("http://localhost:2000/components/canvas-editor-base/generated-index.html?cli_browser_id=0")] Error response status: 6 Selenium error: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'runner-4e4528ca-project-266495-concurrent-0', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-coreos-r2', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=chrome not reachable
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.7.3-coreos-r2 x86_64), platform=ANY}]
Session ID: 6ec7ed7d595d2f61a6b0eca7a536976c
    at /usr/local/lib/node_modules/polymer-cli/node_modules/web-component-tester/runner/steps.js:151:27
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/polymer-cli/node_modules/web-component-tester/runner/steps.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:103:7)
ERROR: Build failed: exit code 1

January 10, 2017

[SOLVED]Docker API connection refused 127.0.0.1:2376

Create a file called /etc/systemd/system/docker-tcp.socket to make Docker available on a TCP socket on port 2375.

[Unit]
Description=Docker Socket for the API

[Socket]
ListenStream=2375
BindIPv6Only=both
Service=docker.service

[Install]
WantedBy=sockets.target


Then enable this new socket:

systemctl enable docker-tcp.socket
systemctl stop docker
systemctl start docker-tcp.socket
systemctl start docker
Test that it's working:

docker -H tcp://127.0.0.1:2375 ps


Source: https://coreos.com/os/docs/latest/customizing-docker.html

July 23, 2014

[SOLVED] Remove Untagged Images From Docker


Remove all stopped containers.
docker rm $(docker ps -a -q)

Remove all untagged images
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")