Yarn package manager, a bless or a curse ?

The other day, a developer on my team decided it was a good idea to leave a pull request half done before going on holiday. So, I went to pick this ticket from the board in order to clear-out things and start shipping the product out of the window … It was somewhat quite hard to understand and solve … so I  decided to write here what happened, maybe someone could benefit from it …

So, there was me, all alone with that issue what was “potentially” a quick fix ….

First things first, lets check that the build is green and CI automation is happy …. I Went to Codeship and oh my dear, someone else outside of my team (probably the maintainer of the module) decided it was a good idea to just delete a existing package from the yarn registry (who cares right?). Consequently, the build is now failing and the error is quite bizarre.

error An unexpected error occurred: "https://registry.yarnpkg.com/acorn/-/acorn-4.0.12.tgz: Request failed \"404 Not Found\"".

Screenshot from Codeship:


Without being able to believe myself / understand the error, I wondered “Someone is definitely doing something nasty” … So I retried the build 3 times … all ending up with the same error.

So I went to double check that module Yarn is complaining about, with curl I checked for the package URL (To find out the obvious, it was deleted):


Yes, it have been deleted. Somehow yarn can’t figure out a solution for it. The author of the pull request said:


With no time to loose, I went deeper into the pull request … for minutes I was fighting with Yarn, NPM … all resulting in the same dead end, that dependency somehow always get written inside the yarn lock file, causing the build to fail.

Ok, so lets delete the yarn file and the new one should be good right ? no more issues like that, right ?

No, this time, after deleting the yarn lock file and generating a new one, I’m having some weird tests that where working before, to fail with even more strange error:

 TypeError: this.context.getStore is not a function

I wonder with myself, what next ? should I fight to fix this error, or should I stick with the old one ?? Fight with Yarn or with the new downloaded yarn dependencies that broke this poor project apart ?

I looked at the clock, the day is about to end, and I have to get this out of the window, and fast. So I decided it was about time to get this done, and fast.

I went on Yarn lock file and analyzed it “line by line”, its was about 8.000 lines …  so I finally  I found the culprit:

acorn@^4.0.3, acorn@^4.0.4:
 version "4.0.12"
 resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.12.tgz#335679ab819ec3c78772fe0c2c2f4bfa4359854e"


So I went on the web and tried to reach out the github repo for acorn … there is no such version 4.0.12, only 4.0.11 or 4.0.10:


So I was like, OMG how the hell this  happened (??), I’m looking at the right acorn ? What to do ? I decided to try my luck with version 4.0.13 ? and TADA, that works like a charm:

acorn@^4.0.3, acorn@^4.0.4:
 version "4.0.13"
 resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"


After so many years doing this, I remember, with NPM it (Or … in the old times Maven) it was nothing different … so I was wondering, is Yarn package manager, a bless or a curse ? Is solving something for real or the issue is just now a little less worse ??

You tell me.



Happy opensource coding to everyone! 😀

Blockchain, Ethererum, Solidity

Solidity, The Ethereum programming model.

Ethereum has a fairly “hard to understand” programming model.

It makes Senior devs, to spend hours chasing their own tails. Wondering what is going on with their code.


So I decided to write this little post, in order to clarify some aspects that I think are Crucial on Any programming language.

The main idea is: YES, Solidity can improve, but there are so many things do be done, most of them are basics that any other programming language have. Things that have been solved long time ago.

Would Ethereum survive and thrive ? 


Solidity includes the following types:

hash: 256-bit, 32-byte data chunk, index-able into bytes and operable with bit-wise operations.
uint: 256-bit unsigned integer, operable with bit-wise and unsigned arithmetic operations.
int: 256-bit signed integer, operable with bit-wise and signed arithmetic operations.

real: 256-bit signed fixed-point quantity, 127-bit left of the point, 128-bit right.
string32: zero-terminated ASCII string of maximum length 32-bytes (256-bit).

bytes32: sequence of 32 bytes (256 bit in total).

address: account identifier, similar to a 160-bit hash type.
bool: two-state value.



All the types (Hash,uint,int,string32, etc) in Solidity are 256-bit wide.

So, no matter what use use (int8, int16, int32). If you create a type in Solidity, its ALWAYS 256-bit.

The native 256-bit wide primitive type is the bytes32.


String concatenation must be done by hand after casting to a byte array.

If you want to use indexOf() you must writte your OWN implementation by hand or copy one into your program.


String Length

To get the length of a string you must cast it to a byte array.

And it gets worse, If you “accidentally” pass a empty string to a function (normal day to day programming issue). This will cause all arguments after that string to be silently corrupted, and of course make you hate your life and all your relatives mother for couple of days. 😀



Despite Ethereum being intended to be used by Finance contracts, floating point is not supported AND Integer operations can overflow.

(That’s a feature, not a bug. Said a solidity developer).

There is a enhancement open in order to provide simple basic functions for fixed point types:


Arithmetic overflows return silently:


A normal JS programmer, would write a for loop like this:

var a[] = (... think there are +256 elements on this array)
for (var i = 0; i < a.length; i ++) {
 a[i] = i;

WELL, if you are programming in Solodity, be advised: This loop it will enter an infinite loop.

Because a[] is a array bigger than 255 elements it will wrap around back to zero.


Array syntax kind of looks like C or Java. BUT, you will freak out now: Array declaration syntax is written backwards:


This syntax declares a 5 dynamic arrays of bytes.


Array of String

Arrays of Strings is not allowed. You cannot create multi-dimensional dynamic arrays.
Because “string” is a byte array, that means “string[]” does not work. 😀


Crash with too large arrays 

A simple uint definition, can cause the compiler to crash with error: Integer constant too large

contract c {
	uint[8**90] ids;
contract c {
	struct Data { uint x; uint y; }
	Data[8**90] data;

Detailed error:

solidity/libsolidity/ast/Types.cpp(977): Throw in function virtual u256 dev::solidity::RationalNumberType::literalValue(const dev::solidity::Literal *) const
Dynamic exception type: boost::exception_detail::clone_impl<dev::solidity::InternalCompilerError>
std::exception::what: Integer constant too large.
[dev::tag_comment*] = Integer constant too large.



The documentation includes a list of …. bugs ….

`In some situations, the optimizer replaces certain numbers in the code with routines that compute different numbers`

`Dynamic allocation of an empty memory array caused an infinite loop and thus an exception`


Garbage Collection (GC):

Oh, if you use Java, NodeJS or Golang, you are adapted and just love your GC skills. You probably never worry about it.
Solidity have no garbage collection.
Dead allocations are never reclaimed, despite the scarcity of available memory space.
There is also no manual memory management. (SCARED).



THIS keyword:

In Solidity there is a “this” keyword …

However there are actually security-critical differences between “this.setX()” and “setX()” that can cause wrong results.

I also really love the way they deal with the issue, very fast and precisely providing a correction. This Dev seems to be also very happy about it:


Just to wrap this up, I don’t want to spoil anyone party here. I just think there is a loot going on on Ethereum right now, developers are working hard and is likely that this get fixed soon (HOPEFULLY).

However, one should consider this points, before diving into programming in Solidity, therefore avoiding new bugs like the $31M stolen couple months ago.


More about it:

Solidity is so riddled with bizarre design errors that it makes PHP4 look like a work of genius.

Exactly, this is a language that they want to run a new economy, not just payment processing, but banking, title transfer, legal resolutions

Underhanded Solidity Coding Contest 

Deconstructing the DAO Attack: A Brief Code Tour

List of “closed” bugs on Ethereum Solidity

List of Open bugs on Ethereum Solidity


Kubernetes DevOps day-to-day tasks and commands – Kubernetes/HELM Cheatsheet


Often I see members of my team struggling to remember the somehow hard to remember commands for operating Kubernetes. Its quite hard to find a descent documentation that goes straight to the point. Not much lalala, but just give me the CMD I’m looking for.

This is a curated list that I’ve been updating periodically with many of the commands I use day to day on operations, so if you know anything that is not here, please let me know! 😀

Kubernetes DevOps day-to-day tasks and commands



Kubernetes – How to change the scope to another namespace

$ kubectl config set-context $(kubectl config current-context) --namespace=env-JIRA-1234

Kubernetes – How to List the active pods on a namespace:

$ kubectl get pods
golang-api-1280745034-4s6jt 1/1 Running 0 17m
golang-api-1280745034-7knzq 1/1 Running 0 17m


Kubernetes – How to Get the logs for a POD:

$ kubectl logs golang-api-1280745034-4s6jt


Kubernetes – How to Get services the Load Balancer IP addresses for a Namespace:

$ kubectl get services --namespace=develop


Kubernetes – How to Get the ingres and services for a Namespace:

$ kubectl get ing,service --namespace=develop

Kubernetes – How to Get info about the services for a Namespace

$ kubectl describe services --namespace=develop 

Kubernetes – How to Get info about the services for ALL Namespaces

$ kubectl get services --all-namespaces


Kubernetes – How to open a proxy to a POD and expose it locally OR (How to connect to a POD directly and expose it locally)

$ kubectl port-forward golang-api-1280745034-4s6jt 8888:3000


Kubernetes – How to configure kubectl to always point to same cluster

$ kubectl config set-context gke_apps_europe-west1-b_europa --namespace=prod

Kubernetes – How to Get the current context (The cluster kubectl is pointing to)

$ kubectl config current-context

Kubernetes – How to setup kubectl Auto Complete

$ source <(kubectl completion bash)

Kubernetes – How to check resource utilization (TOP) for all nodes (Cluster legs)

$kubectl top nodes

Kubernetes – How to check resource utilization (TOP) for all pods in all namespaces

$ kubectl top pods --all-namespaces

Kubernetes – How to WATCH constantly the resource utilization for all pods in a particular namespace and order the results so they don’t keep changing all the time.

$ watch "kubectl top pods --namespace=prod |sort"

Kubernetes – How to WATCH constantly the resource utilization for nodes in a particular namesmace (legs) and order the results so they don’t keep changing all the time.

$ watch "kubectl top nodes --namespace=prod |sort"

Kubernetes – How to WATCH constantly the resource utilization for all pods in ALL namespaces and order the results so they don’t keep changing all the time.

$ watch "kubectl top pods --all-namespaces |sort"


Kubernetes – How to kill all running jobs:

`kubectl delete jobs -l `

Kubernetes – How to SSH inside a node to execute commands

 gcloud compute ssh gke-cluster-default-pool-123-4321s --zone europe-west1-c


Kubernetes – How to SSH inside the pod and perform a curl on the healthcheck endpoint. This is particular useful for troubleshot and assert that the service is really running and healthy.

$ kubectl exec -ti golang-api-1280745034-4s6jt curl http://localhost:3000/health`


Kubernetes – How to Change the configuration file  ‘on the fly’

 kubectl apply -f kubernetes/config/develop.yaml

Kubernetes – How to Restart all PODS in one go:

 $kubectl delete pods -l app=golang-api --namespace=prod

Kubernetes – How to List all Environment variables for a particular POD

$ kubectl exec -ti golang-api-4135068084-3wpb5 env --namespace=prod

Kubernetes – How to Check health for a particular backend POD from inside the frontend pod in order to test that they connect with no issues

$ kubectl exec -ti front-end-355436834-whtnp curl http://golang-api/health --namespace=prod

Kubernetes – How to Check for all logs inside the main scheduler

 $ journalctl -f

Kubernetes – How to List all pods and order them by how many times they have restarted. This is useful to detect memory leaks or debug the pods that are restarting more often.

$ kubectl get pods --sort-by=.status.containerStatuses[0].restartCount

Kubernetes – How to test that your API is returning something on a particular endpoint directly inside the POD (Useful when you deploy something but is not working .. you are pulling your hair out and hating kubernetes … keep call and curl it from inside 😀 )

$ kubectl exec -ti frontend-355436834-whtnp curl http://golang-api/find/1 --namespace=develop


Kubernetes – How to proxy a existing InfluxDB pod so you can use it locally:

$ kubectl port-forward --namespace monitoring $(kubectl get pods --namespace monitoring -l app=influxdb-influxdb -o jsonpath='{ .items[0].metadata.name }') 8086:8086


GCLOUD: How to list all images for your Docker eu.gcr.io:


$ gcloud container images list-tags eu.gcr.io/thomasmodeneis-apps/golang-api


HELM DevOps day-to-day tasks and commands


HELM – How to deploy a Docker image from eu.gcr.io to your cluster:

$ export NAMESPACE=develop
$ export VERSION=1.0.0
$ helm upgrade -i golang-api-$NAMESPACE ./helm_chart \ 
--values helm_values/develop.yaml 
--set cluster=clustername,version=$VERSION


HELM – How to delete a chart and all its pods

helm delete redis-develop


HELM – How to delete a chart and all its pods for a specific namespace:

helm delete redis-develop --namespace=cache-develop


HELM – How to delete a chart and all its pods and purge it, in order to also delete PV and PVC’s associated to it: (Caution, this will delete all your data from stored disks).

helm delete redis-develop --purge



I hope it helps,


Happy opensource coding for everyone 😀

docker, gcloud, golang, kubectl, kubernetes-dedicated, linux, ubuntu

Installing Kubectl with GCloud – Common errors

The Google recommended steps for installing the GCloud and Kubectl are somehow confusing, and I see that often, members of my team are confused and can’t find good enough instructions in order to have this installed correctly.

ERROR 1:  Google is not able to enable component manager. If you have found this post on google search, chances are that you are stuck with the error.

ERROR: (gcloud.components.update) The component manager is disabled for this installation

ERROR 2: Google cant find default credentials

error: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

ERROR 3: Kubectl can’t do anything … error is confusing (what now ?)

➜ kubectl get pods --namespace=develop
 The connection to the server localhost:8080 was refused - did you specify the right host or port?



If you have followed the installation instructions for Mac, Ubuntu,  (and others) Linux distributions chances are that you end-up with a incomplete  google cloud SDK installation.

kubectl is missing on the default instalation, together few many other important tooling.


We will start by listing and learning some useful cheat-sheet commands:

List all availbale components:
$ gcloud components list

Your current Cloud SDK version is: 154.0.1
The latest available version is: 154.0.1

│ Components │
│ Status │ Name │ ID │ Size │
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 47.9 MiB │
│ Not Installed │ Bigtable Command Line Tool │ cbt │ 3.9 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 15.4 MiB │
│ Not Installed │ Cloud Datastore Emulator (Legacy) │ gcd-emulator │ 38.1 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 21.0 MiB │
│ Not Installed │ Emulator Reverse Proxy │ emulator-reverse-proxy │ 14.5 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 3.4 MiB │
│ Not Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │
│ Not Installed │ gcloud Beta Commands │ beta │ < 1 MiB │
│ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 128.6 MiB │
│ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 6.1 MiB │
│ Not Installed │ kubectl │ kubectl │ 14.9 MiB │
│ Installed │ BigQuery Command Line Tool │ bq │ < 1 MiB │
│ Installed │ Cloud SDK Core Libraries │ core │ 6.0 MiB │
│ Installed │ Cloud Storage Command Line Tool │ gsutil │ 2.9 MiB │
│ Installed │ Default set of gcloud commands │ gcloud │ │

To install or remove components at your current SDK version [154.0.1], run:
 $ gcloud components install COMPONENT_ID
 $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [154.0.1], run:
 $ gcloud components update


How to resolve ERROR 1: (gcloud.components.update) The component manager is disabled for this installation:

If you try to use the recommended way to install anything, it will fail and argue something with very little sense like …

ERROR: (gcloud.components.update) The component manager is disabled for this installation



Solution: Remove the google recommended way of installing the Google Cloud SDK and install it again, this time doing it the right way:


  • UBUNTU install steps:
sudo apt-get update
sudo apt-get remove google-cloud-sdk
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud init
gcloud components list

Optionally you can run the one liner command :

sudo apt-get remove google-cloud-sdk && curl -sSL https://sdk.cloud.google.com | bash -


After installing and initializing the gcloud, you are finally able to install a full-blown Cloud SDK installation:

$ gcloud components install kubectl

Your current Cloud SDK version is: 154.0.1
Installing components from version: 154.0.1

│ These components will be installed. │
│ Name │ Version │ Size │
│ kubectl │ │ │
│ kubectl (Linux, x86_64) │ 1.6.2 │ 14.9 MiB │

For the latest full release notes, please visit:

Do you want to continue (Y/n)? y

╠═ Creating update staging area ═╣
╠═ Installing: kubectl ═╣
╠═ Installing: kubectl (Linux, x86_64) ═╣
╠═ Creating backup and activating new installation ═╣

Performing post processing steps...done. 

Update done


After this, you should be able to use gcloud with kubectl. However, you will have to solve more errors … keep reading.


GCLOUD Kubectl Common errors:

Problems may raise. One of them is not having the gcloud configs properly set. This will get you an error like this:

How to resolve ERROR 2: GCLOUD is not able to get your credentials, kubectl is blocked:

error: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

This can be fixed by setting the container credentials for the cluster you are wanting to target:

gcloud container clusters get-credentials europa


How to resolve ERROR 3: kubectl complains can’t find localhost:8080 (???)  

➜ kubectl get pods --namespace=develop
 The connection to the server localhost:8080 was refused - did you specify the right host or port?

To get this solved, you will have to run the gcloud container clusters get-credentials:

gcloud container clusters get-credentials yourclustername
 Fetching cluster endpoint and auth data.
 kubeconfig entry generated for yourclustername.


As you can see, there are many things that can go wrong. But we luck you have most of it covered here. Please let me know if you happen to find any other error that is not covered here.

I hope it helps.


linux, ubuntu

How to fix: ERROR: ld.so: object ‘libgtk3-nocsd.so.0’ from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

This days, after doing a update on Ubuntu, I stumbled upon this error:

ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. 

I’ve looked for answers on the web but there is nothing really specific about it…

I found there is a bug opened on Date: Tue, 10 May 2016 11:27:02 UTC: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823914

But there is no clear resoliton.

It seems that they have raised a bug for the lib, but I’m not sure how this fixed the issue. There is no comments: https://sourceware.org/bugzilla/show_bug.cgi?id=20172


The problem seems to be that Ubuntu is looking for a library that does not exist for some reason.



So if you check for the file, you won’t find anything:

ls -l /usr/lib/x86_64-linux-gnu/ |grep libgtk3

Fortunately, after a big of dig here and there, I’ve found that there is a quick fix. Execute the following command and install the missing library: gtk3-nocsd

$ sudo apt-get install gtk3-nocsd

----- OUTPUT ------
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following package was automatically installed and is no longer required:
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
The following NEW packages will be installed:
 gtk3-nocsd libgtk3-nocsd0
0 upgraded, 2 newly installed, 0 to remove and 119 not upgraded.
Need to get 53,0 kB of archives.
After this operation, 125 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://nl.archive.ubuntu.com/ubuntu artful/universe amd64 libgtk3-nocsd0 amd64 3-1 [13,5 kB]
Get:2 http://nl.archive.ubuntu.com/ubuntu artful/universe amd64 gtk3-nocsd all 3-1 [39,5 kB]
Fetched 53,0 kB in 2min 0s (440 B/s)
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.)
debconf: falling back to frontend: Readline
Selecting previously unselected package libgtk3-nocsd0:amd64.
(Reading database ... 423877 files and directories currently installed.)
Preparing to unpack .../libgtk3-nocsd0_3-1_amd64.deb ...
Unpacking libgtk3-nocsd0:amd64 (3-1) ...
Selecting previously unselected package gtk3-nocsd.
Preparing to unpack .../gtk3-nocsd_3-1_all.deb ...
Unpacking gtk3-nocsd (3-1) ...
Setting up libgtk3-nocsd0:amd64 (3-1) ...
Setting up gtk3-nocsd (3-1) ...
Processing triggers for libc-bin (2.24-12ubuntu1) ...
Processing triggers for man-db ( ...


Check that you have the required file:

ls -l /usr/lib/x86_64-linux-gnu/ |grep libgtk3
-rwSr--r-- 1 root root 26616 jun 1 2016 libgtk3-nocsd.so.0


Happy opensource coding for everyone! 😀


automation, kubernetes-dedicated, linux, packet.net

Kubernetes, Helm and RancherOS

What is Helm?

Helm is the package manager for Kubernetes.

Helm is divided into two parts, the Helm Client (client) and Tiller Server (server)

Why do I need Helm?

To exemplify why do I need helm, I will tell you:

How my life was before Helm:

In order to get any kubernetes apps up and running, I had to:

  • Write Kubernetes manifests by hand
  • Do this everytime I wanted to release anything
  • Figure out how to deal with sharing this with other team members
  • Tweak all the resources by hand
  • Use kubectl to manage it


How is my life now with Helm:

  • Installing resources with kubernetes is now easy like apt-get, yum, homebrew … etc
  • My team is now able to colaborate, sharing helm charts on our internal repositories
  • Releases are reproducible across all environments (develop, accept and production)
  • Packages are now sharable



  • Charts: A bundle of kubernetes resource data, it operates the System Package
  • Repository: A collection of release charts, something like NPM, or Ubuntu Repository.
  • Release: A chart instance that was loaded into Kubernetes. If the same chart is installed several times inside the same cluster, each time the cart will have its own release.


Installing Helm on RancherOS

If you are trying to install Helm on RancherOS, chances are that you are now running into the problem that RancherOS does not come with cURL installed.

[rancher@kubernetes1 ~]$ curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
-bash: curl: command not found

Due to the fact that Helm uses cURL to download its dependencies, please follow up How to install cURL on RancherOS


Download Helm executable script:

[root@kubernetes1 ~]# curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5962 100 5962 0 0 47711 0 –:–:– –:–:– –:–:– 55203


Add the chmod to the executable file:

[root@kubernetes1 ~]# chmod 700 get_helm.sh

Install Helm:

[root@kubernetes1 ~]# ./get_helm.sh

Happy Helming



automation, docker, kubernetes-dedicated, linux, rancher server, rancheros

How to install Rancher Server on RancherOS

How to install Rancher Server on RancherOS ?

If you are playing with RancherOS, chances are that you are stuck trying to figure out how to get the Rancher Server (Web UI) up and running after your fresh RancherOS installation.

Why RancherOS?

With RancherOS,  your server runs on a System Docker as the first process the kernel starts.

The System Docker replaces systemd, thus allowing RancherOS to manage all system services as Docker containers.


In order to get started on it, I’ve created this little guide for my own reference, I hope it helps:


Installing Rancher Server on RancherOS with Docker


$ sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server
Unable to find image 'rancher/server:latest' locally
latest: Pulling from rancher/server

6599cadaf950: Pull complete 
23eda618d451: Pull complete 
f0be3084efe9: Pull complete 
52de432f084b: Pull complete 
a3ed95caeb02: Pull complete 
e75cd91a1dc5: Pull complete 
997f1b48f59f: Pull complete 
313c28fb4e37: Pull complete 
2a0730d1275c: Pull complete 
8848fbebd2c8: Pull complete 
bf44fc918d8d: Pull complete 
294d2b8ef44a: Pull complete 
8ef53e786a1e: Pull complete 
c66f5c1af2aa: Pull complete 
21a529f5f5c5: Pull complete 
e0b120915e7e: Pull complete 
1ce569657333: Pull complete 
a21d853ef921: Pull complete 
d11646728ac8: Pull complete 
Digest: sha256:59dba13b5cc1f50bbeb9127ed77cc5e72674e80f92dc0a22905a5df9372af464
Status: Downloaded newer image for rancher/server:latest

Check that the docker instance of rancher is up and running:

[rancher@kubernetes1 ~]$ docker ps
8064ddc60d59 rancher/server "/usr/bin/entry /usr/" About a minute ago Up About a minute 3306/tcp,>8080/tcp hungry_roentgen

Installing Rancher Agent on RancherOS with Docker
[rancher@kubernetes1 ~]$ sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.2
Unable to find image 'rancher/agent:v1.2.2' locally
v1.2.2: Pulling from rancher/agent
b3e1c725a85f: Pull complete 
4daad8bdde31: Pull complete 
63fe8c0068a8: Pull complete 
4a70713c436f: Pull complete 
bd842a2105a8: Pull complete 
3f7d6fd71888: Pull complete 
16914729cfd3: Pull complete 
b9c91512c230: Pull complete 
Digest: sha256:cfb7fc0de1146680ca26e3bc8cd09cc7a0274eff99f5b84246c33642a99f81da
Status: Downloaded newer image for rancher/agent:v1.2.2

INFO: Running Agent Registration Process, CATTLE_URL=
INFO: Attempting to connect to:
INFO: is accessible
INFO: Inspecting host capabilities
INFO: Boot2Docker: false
INFO: Host writable: true
INFO: Token: xxxxxxxx
INFO: Running registration
INFO: Printing Environment
INFO: ENV: CATTLE_HOME=/var/lib/cattle
INFO: ENV: RANCHER_AGENT_IMAGE=rancher/agent:v1.2.2
INFO: Launched Rancher Agent: ca73dede34008Installing Rancher Agent on RancherOS92f9203b1b45a9c3228d267cd2f723b105805c5dfa25170373e

You can now access your Rancher Server on the provided IP address, on my case (eg: