jenkinsci / jenkinsci/docker-plugin

Using Jenkins Docker Slaves on Amazon Linux 2 AMI

Open
#820 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
498
Forks
324
Avg merge
1d 2h
Merged PRs (30d)
2

Description

I'm running into a strange issue using the standard docker images provided by Jenkins - only when Jenkins is running on Amazon Linux 2 though. Jenkins on Ubuntu 18.04 works fine.

The problem is that Jenkins is not able to launch these slave containers.

Connect method - "Attach Docker Container" since the docker engine is running locally on the Jenkins server.

Interestingly, I've been able to get these containers to successfully run for a build on Amazon Linux if I set USER root in a new DockerFile (not required on Ubuntu). However, I need these to be running as a non-root user (like jenkins user) in order to run unit testing for postgres.

Any thoughts on how I can achieve that for Amazon Linux 2? Could I be missing a docker setting or security setting on the OS?

Docker images I've tested:

- https://hub.docker.com/r/jenkins/agent/
- https://hub.docker.com/r/jenkins/jnlp-slave
- https://hub.docker.com/r/jenkins/inbound-agent

If you are sure that this plugin is the source of your troubles then please report:
- [1.2.1 ] docker-plugin version
- [2.266 ] jenkins version
- [19.03.13-ce ] docker engine version
- ["Attach Docker Container" ] details of the docker container(s) involved and details of how the docker-plugin is connecting to them

### The errors aren't super helpful:

![image](https://user-images.githubusercontent.com/16522814/99213143-0eab2780-278a-11eb-92eb-c66607cc75bb.png)

Connecting to docker container 4486c8f2696f40c7de32160d78d6e2438abb1ff92517c71cf66b93baf3d0877f, running command java -jar /home/jenkins/remoting-4.6.jar -noReconnect -noKeepAlive -slaveLog /home/jenkins/agent.log HTTP/1.1 101 UPGRADED Content-Type: application/vnd.docker.raw-stream Connection: Upgrade Upgrade: tcp Api-Version: 1.40 Docker-Experimental: false Ostype: linux Server: Docker/19.03.13-ce (Linux)

ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins

### Basic Setup to Reproduce:
![image](https://user-images.githubusercontent.com/16522814/99213234-4fa33c00-278a-11eb-8174-6d253ae7643d.png)

### Docker Template:
![image](https://user-images.githubusercontent.com/16522814/99213256-5cc02b00-278a-11eb-8be5-b243ae6ed3bf.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.