how to run Docker in Travis hosted in travis-ci.com - docker

I am trying to run some tests in Travis CI using Docker (and docker-compose).
A search on "run docker in Travis" does yield several how-to-do results, but none of these seem to be running remotely on Travis CI (travis-ci.com), instead I assume are on local Travis.
The answers to the closest question I found, Can travis-ci run docker? , have not helped me so far.
The problem I encounter is that Travis CI runs Ubuntu 12.04 on an outdated kernel and installing Docker requires updating the kernel and rebooting - but 'sudo reboot' will cause the virtual machine to be destroyed and leads to an infinite cycle of [install kernel -> reboot -> install_kernel ...]

Just wanted to drop in a quick note that Docker support for Travis CI is now official: http://blog.travis-ci.com/2015-08-19-using-docker-on-travis-ci/
It's support Docker and Docker-compose.

https://github.com/moul/travis-docker claims support for Docker in Travis. It apparently uses User Mode Linux to achieve this. I haven't tried this yet.

I know it does not help you with travis-ci but I build my docker image on circle-ci. Also Circle-CI just upgraded to docker 1.6.2.
My build file can be found here:
https://github.com/blacklabelops/jenkins/blob/master/circle.yml

Related

visual-studio-code : failed to connect. is docker installed?

my environment :
MacOS M1 chip
VSCode version 1.66.2 arm64
local installed docker version : 20.10.22
I have situations that docker is not working in VSCode.
I already installed docker in local. But when I'm trying to connect docker in VSCode, repeatedly asking install docker extensions. (but I do have docker already ). and if I do reinstall with following the VSCode, the docker version was broken (changed to intel chip docker).
Does anybody know what's wrong?
Docker Extensions for VS Code have nothing to do with the Docker engine itself. They are like an additional layer of tools and commands over the installed Docker. E.g. they provide IntelliSense for editing Docker-related files, you can run Docker commands from F1 drop-down, etc. But you should be able to do all the required tasks even without Docker Extensions, e.g. from the Terminal in VS Code, but for this the path to Docker CLI (command line interface) should be added to PATH environment variable.
If you are getting failed to connect error then maybe Docker engine is not running. Please refer to https://docs.docker.com/desktop/install/mac-install/ and https://docs.docker.com/desktop/troubleshoot/overview/ about how to check if the engine is running and how to troubleshoot the issues.
If that doesn't help, please provide some specific error and steps, which led to it, then we'll try to find out.

How do you resolve the GitLab error "Error response from daemon: invalid condition: 'not-running'"?

I set up a Windows GitLab runner that's supposed to download a Docker image from our Container Registry and then run a build script in the pipeline. Unfortunately the Docker container never launches due to the following error:
Running with gitlab-runner 15.1.0 (76984217)
on WindowsDockerRunner wZMWQZYi
Resolving secrets
Preparing the "docker-windows" executor
Using Docker executor with image mcr.microsoft.com/windows/servercore:ltsc2019 ...
Pulling docker image mcr.microsoft.com/windows/servercore:ltsc2019 ...
Using docker image sha256:e6b07227af5ca9303c2112b574f6f27f38135bbf9df29d829142410221967401 for mcr.microsoft.com/windows/servercore:ltsc2019 with digest mcr.microsoft.com/windows/servercore#sha256:26c6c296a4737ba478fe3c3e531b098f89b5562c40b416ba6fb8177ac462d1af ...
Preparing environment
Running on RUNNER-WZMWQZYI via
runner2...
ERROR: Job failed (system failure): prepare environment: Error response from daemon: invalid condition: "not-running". Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
The error message doesn't clearly state what the cause of the problem is and the documentation that it references doesn't mention anything about "condition". Based on the link pointing to shell profiles I suspect it might have something to do with the shell that's being run, but when I run the Docker container locally it boots into PowerShell just fine.
Does anyone know how to solve this?
I came across this issue after installing Docker Engine using the Windows Server install script, which fetches docker.exe and dockerd.exe from https://master.dockerproject.org, These builds were last updated in March 2022, I found gitlab-runner 14.9 and earlier work okay with this version (released prior to March 2022), but 14.10 does not (released 2022-04-19) nor do any newer versions.
Installing Docker Desktop resolves this as it provides the latest version. However using Docker Desktop introduces licensing issues. An alternative is to manually install Docker Engine / update the version downloaded by the Microsoft script.
Docker Engine builds are provided on the Moby GitHub project to download from https://download.docker.com/win/static/stable/x86_64/ downloading the lastest version from here and replacing the docker executables in C:\Windows\System32 fixes the problem, working with the latest gitlab-runner.
An alternative is to use the docker-engine chocolatey package (which incidentally I maintain) which provides installation scripting for the above stable builds:
choco install docker-engine
There is also an open issue with the Windows-Containers team to move off (out of date) nightlies: https://github.com/microsoft/Windows-Containers/issues/256 which would provide a stable docker build, through the Microsoft recommended installation method.
Was finally able to solve this issue. We had the Docker Engine installed on our GitLab Runner, but that doesn't seem to be sufficient for GitLab CI/CD. After installing Docker Desktop on the runner the issue disappeared and we were able to run the pipeline.
After some trial and error I got it up and running.
I have another server running the gitlab-runner and docker without any issues (no docker desktop installed, which is not allowed because of licensing stuff).
The server I'm trying to setup right now is a 'redundancy' build server.
So to find out what was my problem, I started switching things from one build server to the other. Currently, it appears that simply downgrading to the gitlab-runner V13.4.0 was enough.
I did reregister the runner, since gitlab stated that the V15.x.x version was using executor "unknown".
Not sure what is going on there, but at least I can continue building now.

ERROR: Couldn't connect to Docker daemon at http://0.0.0.0:2375 - is it running?

I am watching a course on Hyperledger Composer development online. I installed all the required prerequisites, docker, docker-compose, nodejs, golang. After cloning the fabric-samples repository from github. There is a file called byfn.sh inside a folder called first-network. On running the command ./byfn.sh up, it's giving the following error:
If, someone has experience working on it, please help. Any help would be appreciated. Thank you.
I think the first thing you should do is stop looking at or trying to use Hyperledger Composer. It is end of life now and some of it's components will have problems even if you install the exact required versions (for example the rest server fails to launch now on node 8 but changing to a newer version of node may break other parts of Composer).
As you had planned to use it with hyperledger fabric I would suggest that you just invest your time in Hyperledger fabric, see https://hyperledger-fabric.readthedocs.io/en/latest/
Regarding your problem with docker, I suspect you tried to install docker through the apt command in your wsl window ? I'm guessing that you are using WSL2, but if you are using WSL1 then docker will never work in a WSL1 environment. If it was WSL2 then the docker daemon doesn't automatically start in that environment you need to start it yourself first. I think the command is service docker start. The important thing here is to make sure you are using WSL2 and not WSL1 (see hyperledger fabric link later which provides guidance on making sure you are using WSL2).
An alternative to installing docker into WSL2 directly would be to install Docker Desktop for Windows and follow the hyperledger fabric instructions here https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html#wsl2

Jenkins and Kubernetes in the same VM

I am doing a test here and need to delivery a build, test and deploy pipeline using Jenkins and Kubernetes.
I am using a Mac and created a VM using VirtualBox with Ubuntu 18 and installed Jenkins there.
I installed Kubernetes (minukube) but when I try to start it I receive:
"This computer doesn't have VT-x/AMD/v enabler. Enabling it in the BIOS
is mandatory"
Reading some blogs they said that VM inside VM is not a good architecture.
My question is: what is the best approach to do it and have something to delivery in the end - like a VM or a weblink?
I couldn't put a comment, cause I don't have enough permissions to do so.
This is not related to k8s, your issue most likely is with the virtualization in your PC, you may follow the error you got and try to enable to the VTx/AMD option in the boot.
Install minikube in your laptop, then run Jenkins X in minikube and that will give you CI/CD and kubernetes, all in one vm

Can travis-ci run docker?

I am unable to run a docker container in a Travis continuous integration job.
https://travis-ci.org/buildbot/buildbot/builds/36547150
pkg/installation_tests/testall.sh
Segmentation Fault or Critical Error encountered. Dumping core and aborting.
pkg/installation_tests/testall.sh: line 16: 7343 Aborted docker build $dir
make: *** [docker_install_tests] Error 1
My guess is that there are missing kernel stuff in the travis workers, but it is difficult to tell.
As of August 2015, Travis CI officially supports Docker.
See Using Docker in Builds for usage details.
Sorry, while we currently support Docker as an alternative virtualization platform, we don't directly support running Docker inside of the current setup, at least directly.
However, there are workarounds that could help you there from the fine folks at Docker themselves: https://github.com/jpetazzo/sekexe
In case you have not yet solved the problem yourself, here https://github.com/rocker-org/rocker/blob/56cb59cc262e9d2c02f9e11cfacab65f0b659c5f/.travis.yml#L10-L24 you can find a practical example of the solution suggested above.

Resources