Showing posts with label command line. Show all posts
Showing posts with label command line. Show all posts

Sunday, 2 April 2017

finding the docker mount volume location - running jenkins in a container

Finding the Docker mount volume location, running Jenkins in a container


I love running jenkins in a container, no installation locally, and it really is awesome to just spin up a docker container image and run a build process.

I had setup a jenkins container around 5 months ago running on docker and forgot the password and the path to the mounted volume. Here's how you go about getting the volume so you can reset the password

Locate the volume  


I configured my jenkins to use a mounted volume, and had no idea where it was. This is a lazy manner of getting the path - it will be under the mount section:

docker inspect my-jenkins | grep "Source"
Update: this is the proper way to get the mount source:
docker inspect --format='{{range .Mounts}}{{ .Source}}{{end}}'

and locate the folder locally, mine was at
/var/lib/docker/volumes/e6bc1cd088645a4f5b7f69c0ba00951b159b0ccf552cf02bd31c85d64cb35626/_data

Now that I have the mount path I can change the security attribute to false, log in and configure the security again, but at least I am back in.



Docker makes playing with software in images simple; in this way even though I have java installed locally I don't need to spin up and keep jenkins running all the time, just when I want to spin it up.

Cheers
Quintes

Connect with me on LinkedIn or Twitter






Tuesday, 22 July 2014

centOS 5 error Address family not supported by protocol when performing yum update

You're running 'yum update' on a centOS 5 box and get this error:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os error was
[Errno 4] IOError: <urlopen error (97, 'Address family not supported by protocol')>
Error: Cannot find a valid baseurl for repo: base
The solution is that you need to setup your proxy, so open up a terminal and type as follows:

http_proxy="http://username:password@proxyurl:port/
export http_proxy
yum update
You should find that the yum command is executed without error:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.joinweb.co.il
 * extras: centos.joinweb.co.il
 * updates: centos.joinweb.co.il
base                                                     | 1.1 kB     00:00
base/primary                                             | 1.3 MB     00:24
base                                                                  3662/3662

curl usage or how to post to a webservice from the commandline


curl is super for talking to http from the command line.

HTTP GET

In general, to use curl to do a GET request do as follows:

curl -v -H "header:value" http://host:port/webservice/uri

HTTP POST

To POST to a RESTful webservice, in this instance a JAX-RS Jersey REST service running on Jetty on an IBM AIX box:

  • Using curl 7.30.x from Windows
curl -H "header:value" -X POST -d "{json}" http://host:port/webservice/postResource
Note that you may have to escape the double quote in a json string, e.g. '{\"Key\":,\"Value\"}'  when posting the JSON data right on the command line.
  • Using curl 7.9.3 on the IBM AIX, the POST argument aint gonna fly:
curl -H "header:value" -X POST -d "{json}" http://host:port/webservice/postResource

Here's a tip - Passing the json on the command line is actually not great, its tough to read and tough to write out.

Rather create a file for the json packet and pass as an argument to curl like this:
curl -H "header:value" -X POST -d @myfilename.txt http://host:port/webservice/postResource

Wednesday, 16 July 2014

Install curl on an IBM AIX

Get curl onto an IBM AIX. Here's how.

It is pretty simple - download curl from the IBM site
then run:
su -c rpm -Uvh curl-7.9.3-2.aix4.3.ppc.rpm
 done.