I have a Kubernetes pod based on jenkins/slave container to which I mount docker socket and docker binary file with necessary kernel module in privileged mode. Inside that pod I build Docker image basing on which I run docker container. Inside that container I don't have Internet connection at all because pod container uses flannel network (198.x.x.x) and that container uses bridged docker network (172.x.x.x) which is not available inside pod container. How can I make Internet to be available inside the second container which is being created inside Kubernetes pod container? Using Docker API in Jenkins pipeline is not a solution for me as long as it limits output of error logs and I can not commit changes made in the second container because of immediate removing of that container after build.
相关问题
- Microk8s, MetalLB, ingress-nginx - How to route ex
- How do I change the storage class of existing pers
- Docker task in Azure devops won't accept "$(pw
- Use awslogs with kubernetes 'natively'
- Unable to run mariadb when mount volume
Not sure if this article will help you with this issue, JENKINS DECLARATIVE PIPELINES WITH KUBERNETES . This article shows a full stack on how to setup Jenkins in Kubernetes and also involves idea about Docker in Docker.
Based on my thought, we could mark as pod container as
container1
and container in pod ascontainer2
.I think
container1
andcontainer2
should locate in the same host and shared the same docker engine. So flannel network with docker network should setup together.As my idea, network flow for
container2
should be fromcontainer2
->docker0
->host
, should be not withcontainer1
.Just let me know if this should be reasonable, or we could discuss together, I think this question is very interesting.