Intro
I think so curl is fun, I had many opportunities to play with curl by POSTing, or for example reading session from cookies, so would like to summarized it.
Test Environment
Let’s start
- Simple docker-compose for Jenkins
version: '3.7'
services:
jenkins:
image: jenkins/jenkins:lts
privileged: true
user: root
ports:
- 8081:8080
- 50000:50000
container_name: jenkins
volumes:
- /tmpy:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/local/bin/docker:/usr/local/bin/docker
- Run command
docker-compose up -d
and after starting the container, go to the address http: //<IP-ADDRESS>: 8081. We will need password from container we can get it with this commanddocker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword.
After complete the configuration of Jenkins, we can start play with curl.
GET
If you just want to make a GET request, you don’t need any options.
root@vagrant:/home/vagrant/jenkins# curl http://192.168.123.123:8081/api/json |…