Jenkins and Kubernetes in the same VM - docker

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

Related

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

Cannot pull the project from Bitbucket (the project is with IP restrictions) while using Docker with WSL2 Ubuntu-20.04 Distro

I've a Symfony project that I am running on my PC with Symfony serve.
This project is on Bitbucket that has IP restrictions, I can only work from home and nowhere else for security reasons, and all works just fine :).
I wanted to create a Docker image so that I can easily change my machine and be able to deploy it elsewhere.
So I created a Docker image and did the necesseray configurations and all seems good, I can open the project and work the same way as before. The Docker has the default WSL (WSL1) and I've noticed that the application isn't running as fast as usual (outside the Docker, to load a page it would take 3 seconds, while with Docker it takes at least 30 seconds).
I did some research and found out that I could use the WSL2 with DOCKER which provides better performance than the legacy Hyper-V Backend and Enabled integration for the distro UBUNTU-20.4. The problem using the WSL2 is that I am no longer able to pull my project in the WSL2 (from the Ubuntu-20.0) because of the IP restrictions.
It is really strange that I cannot find any configuration for this and I have no idea what should I do to change it. If I pull the project outside the WLS2 distro it works, with the default WSL it works also but not with the WSL2.
I removed the IP restrcitions and the Docker image worked fine, I have the same speed as If I was outside the Docker. The only problem is that I cannot use the IP restrcitoins for this !
Does anyone know how to fix this ? I haven't been able to find any documentation for this issue.
I am using Windows 10 and the Docker version : 4.5.1 (74721)
Thanks a lot for any information.

VS Code "Attach Visual Studio Code" to remote container error

I am trying to develop in a remote container.
I run VS Code on my local windows machine.
I have a linux machine which runs docker and a bunch of containers.
I have the "Remote - Containers" and "Remote - SSH" extensions installed in VS Code.
I can connect to my linux machine in VS Code and I can see the running containers.
I can right click on a container and choose "Attach Shell". This works fine:
When I right click on a container and choose "Attach Visual Studio Code" I get an error:
UPDATE
The above error was raised because (for some reason?) docker must be running locally on windows also even though we are fully on a remote machine. I've installed and run docker locally.
Now when I right click on a running container, I get a different error:
Of course the containers are running -- I see them.
How can I Attach Visual Studio Code to a running remote container successfully?
This may not be a real answer but it's too much for a comment.
I believe you have a local machine and docker on a remote server.
The first thing you have to do is to install docker on your local machine and configure it so that's its looking for the docker host on your remote server.
Then you can create a .devcontainer.json on your machine. If you have the extension installed, VSCode will offer you do open this as container environment. Since your docker host sits on remote, this will now happen on your server instead of your local machine.
When I did the setup, I followed amongst other things this guide. Especially the SSH-Agent was required to get a remote docker host working. https://code.visualstudio.com/docs/remote/containers-advanced#_a-basic-remote-example
Here is a example .devcontainer file of mine.
Now back to your initial question, I don't think you will be able to use the remote container extension on a container that wasn't started as dev container. This is because vscode will install a bunch of stuff in there when its first set up. Similar to the SSH Extension. I may be wrong on this so take it with a grain of salt.
It may also be worth noting that once you connect to your server via SSH and have then the regular docker extension (which is not the remote container extension) installed, on remote, you will see your docker images listed there. But that does not mean you will be able to connect like that from local to remote container. For that you need to configure a docker remote host.
I have also faced similar issue after doing some research I found the issue was with my installation.
But I faced this issue when I installed vs-code through snap in Ubuntu.
May be try uninstalling VS Code and reinstalling it.
It should work if Docker is installed properly.

Vagrant or Docker for environment development

in our compagny we want to prepare an environment development for our internships so that they don't waste time to install all the tools that they're going to use (Wamp server, IDE's, different navigators, java ...).
We also want these development envrionments to be instances so that for example we can access wamp services in the virtual machine from the navigator that runs on the real os of the machine.
What's the best choice to do this Vagrant or Docker? How can we prepare this solution?
A tutorial link will be very helpfull, Thanks.
I would use both
Our host is Windows, we use vagrant to up a VM and in that VM we install docker then we can run docker containers therein, mapping ports from host to VM then VM to container, allowing container access from host
In my GitHub repo danday74 I have a repo called vagrant-docker-skelly ... Ignore everything else in that repo except the vagrant file ... Use this vagrantfile to up a VM with docker installed
All the best
I use vagrant for my local development. I put my working directory on a github private repo and the vagrant config files to another called Vagrantlife so that I push or pull each time I finish or start the work, either at home or on a new machine, as long as there are Vagrant and Virtualbox installed.
And I did some research on docker which end up some experienced developers saying docker doesn't have a good support on all platforms which is also mentioned in the document in Vagrant.

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

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

Resources