Is it possible to get the Docker service version using the Remote API, that is, something similar to passing the version parameter to the command line client?
docker --version
Yes; it's the /version endpoint.
From the docs:
Example request:
GET /version HTTP/1.1
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"Version": "1.5.0",
"Os": "linux",
"KernelVersion": "3.18.5-tinycore64",
"GoVersion": "go1.4.1",
"GitCommit": "a8a31ef",
"Arch": "amd64",
"ApiVersion": "1.20",
"Experimental": false
}
Related
I created a Cloud Run Job using command line:
gcloud --verbosity=debug beta run jobs create my-job \
--image=us-docker.pkg.dev/cloudrun/container/job:latest
When I can list the jobs using the API Client library, my-job is returned:
import googleapiclient.discovery
with googleapiclient.discovery.build('run', 'v1') as client:
request = client.namespaces().jobs().list(parent=f'namespaces/my-project')
response = request.execute()
print(response)
However, when I try to get the job using the following snippet, I get 404 "Requested entity was not found":
...
request = client.namespaces().jobs().get(name='namespaces/my-project/jobs/my-job')
response = request.execute()
...
I am also unable to create a job using the following snippet, this again return 404 "Requested entity was not found":
request = client.namespaces().jobs().create(parent=f'namespaces/my-project',
body={
"metadata": {
"name": "my-job2",
},
"spec": {
"template": {
"spec": {
"template": {
"spec": {
"containers": [{
"image": "us-docker.pkg.dev/cloudrun/container/job:latest"
}],
}
}
}
}
},
})
I have Cloud Run Admin permissions for the project.
What am I missing?
Looking into the API reference, it appears you are using the call correctly 1, 2. When doing the get call, you need to specify the correct regional endpoint. So, it might happen that you are using the global endpoint for the list, create and get calls. However, make sure that you use the regional endpoint for the get and create call.
The global endpoint has this documentation for v14: "For v1, this endpoint only supports Global List: use regional endpoints instead."
You can see an example using this command from cloud shell. (This assumes your region is 'us-central1', if not that needs to be updated).
curl -X GET
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token)
https://us-central1-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/my-project/jobs/my-job
curl -X GET
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token)
https://run.googleapis.com/apis/run.googleapis.com/v1/namespaces/my-project/jobs/my-job
I'm interested in setting up Jenkins to test and launch my applications on Nomad and am trying to connect the two using https://github.com/jenkinsci/nomad-plugin
I've installed and been able to connect to and validate the connection to Nomad from Jenkins. I have a simple pipeline that just echos via bash, and I can see Jenkins is able to launch Nomad jobs and allocations. However, these jobs stall and die. Looking at the Nomad logs, I can see:
INFO: Locating server among [http://localhost:8080/]
May 06, 2022 8:16:36 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: Failed to connect to http://localhost:8080/tcpSlaveAgentListener/: Connection refused (Connection refused)
It sounds like Nomad isn't able to find its way back to Jenkins, even though that's the correct Jenkins port on my machine.
Is there some additional setup I need to follow to allow Nomad to pass information back to Jenkins? Is there an issue with the tunnel? I did enable the fixed tunnel port of 50000 to match the template below.
My Nomad job template in Jenkins:
{
"Job": {
"Region": "global",
"ID": "%WORKER_NAME%",
"Type": "batch",
"Datacenters": [
"dc1"
],
"TaskGroups": [
{
"Name": "jenkins-worker-taskgroup",
"Count": 1,
"RestartPolicy": {
"Attempts": 0,
"Interval": 10000000000,
"Mode": "fail",
"Delay": 1000000000
},
"Tasks": [
{
"Name": "jenkins-worker",
"Driver": "docker",
"Config": {
"image": "jenkins/inbound-agent"
},
"Env": {
"JENKINS_URL": "http://localhost:8080",
"JENKINS_AGENT_NAME": "%WORKER_NAME%",
"JENKINS_SECRET": "%WORKER_SECRET%",
"JENKINS_TUNNEL": "http://localhost:50000"
},
"Resources": {
"CPU": 500,
"MemoryMB": 256
}
}
],
"EphemeralDisk": {
"SizeMB": 300
}
}
]
}
}
"JENKINS_URL": "http://localhost:8080",
The address of jenkins url is invalid, which is what the message is about. Give the ip address of jenkins instance, not localhost. localhost inside the docker container is the docker container localhost.
Also, remember to enable connections to port 50000 in jenkins, there is an option for that.
I am facing a very peculiar issue. I am using AppVeyor for my CI/CD and apparently the OS version of mcr.microsoft.com/dotnet/framework/aspnet:4.8 image is different on AppVeyor server and on my system.
This is what I get when I inspect the image on AppVeyor
"Architecture": "amd64",
"Os": "windows",
"OsVersion": "10.0.17763.1637",
"Size": 8424507509,
"VirtualSize": 8424507509,
"GraphDriver": {
"Data": {
"dir": "C:\\ProgramData\\Docker\\windowsfilter\\299141c3a9068896ce9f5928d7b9174570a2ef0b5f59a9b45ca0d768c3a09206"
},
"Name": "windowsfilter"
},
as compared to this, which is what I have on my system
"Architecture": "amd64",
"Os": "windows",
"OsVersion": "10.0.19041.685",
"Size": 5541468778,
"VirtualSize": 5541468778,
"GraphDriver": {
"Data": {
"dir": "C:\\ProgramData\\Docker\\windowsfilter\\c9c52e1316159499618a9c15b326fdc7457db4f4de07af590039086de5bc82e0"
},
"Name": "windowsfilter"
},
There is a difference between OS version and other properties. So I tried pulling the images again on the basis of digest
docker pull mcr.microsoft.com/dotnet/framework/aspnet#sha256:d7adec80a9a43d801891458040018972ac006aeca2903cdc6369f69f54951b22
but nothing gets updated.
The problem this is causing is that I have custom image that gets build on my system that has an OSversion "OsVersion": "10.0.19041.685". This image is used by Appveyor to build my final image, and as expected this throws an error as explained in Microsoft Container Versions.
Can anyone help me understand why that's happening.Thanks!
AppVeyor image is based on Windows Server 2019, so 10.0.17763 is the latest version of base image that can be run on AppVeyor. You are on Windows 10 version 2004 which is build 10.0.19041.
I am using Ansible to check the status of several jenkins servers. The playbook that I have created checks the disk space, uptime, and jenkins version perfectly fine. However, I tried to add a task that prints out a list of the installed jenkins plugins for each server by using the jenkins_Script module and keep receiving a '403' error message.
Playbook:
- name: Obtaining a list of Jenkins Plugins
jenkins_script:
script: 'println(Jenkins.instance.pluginManager.plugins)'
url: 'http://server.com:8080/'
user: '*****'
password: '*****'
Output:
fatal: [server]: FAILED! => {
"changed": false,
"failed": true,
"invocation": {
"module_args": {
"args": null,
"force_basic_auth": true,
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"script": "println(Jenkins.instance.pluginManager.plugins)",
"url": "http://server.com:8080/",
"url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"url_username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"user": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"validate_certs": true
}
},
"msg": "HTTP error 403 HTTP Error 403: No valid crumb was included in the request"
}
-- I believe I have narrowed down the issue - It looks like I wasn't providing a crumb. I have since generated the crumb, but there is no 'crumb' arguement for the jenkins_script module. Does anyone know how to successfully provide a crumb?
Will gladly clarify anything stated above if needed, and any assistance is greatly appreciated.
https://github.com/ansible/ansible/pull/20207
-- if you're on ansible 2.3 the changes have already been committed all you have to do is make sure 'cross site request forgery' is enabled on the jenkins servers. (Manage jenkins > Configure Global security)
I have following docker engine and API version.
{
"ApiVersion": "1.17",
"Arch": "amd64",
"GitCommit": "a8a31ef",
"GoVersion": "go1.3.3",
"KernelVersion": "3.19.0-30-generic",
"Os": "linux",
"Version": "1.5.0"
}
It shows the Engine version as 1.5.0 but the API version as 1.17. How should I upgrade the API to version 1.21?
I am using ubuntu 15.04.
Thanks.
https://docs.docker.com/installation/ubuntulinux/#installation
API version 1.21 is not released yet, but you can upgrade to 1.20 by following the steps at that url