Docker build tyk.conf

Imported Google Group message. Original thread at: Redirecting to Google Groups Import Date: 2016-01-19 21:14:00 +0000.
Sender:S. Alexander Zaman.
Date:Monday, 25 May 2015 23:14:19 UTC+1.


I’ve been trying to mess with tyk so I can use it to set up a gateway’d, secured web-api. I like the interface but I’m running into a few problems. One of them is that I am trying to set up a flow where I can create keys from my web server when the user logs in. I’d like to access the rest api but it says I need " to set the secret parameter in your tyk.conf file. "

Since I used the docker script, I’m not sure where or how to set the file. Any advice on how I can gain access to the tyk rest api?


Imported Google Group message.
Sender:S. Alexander Zaman.
Date:Tuesday, 26 May 2015 00:53:01 UTC+1.

Ok I think I figured out how to get into tyk.conf file and grab the secret

  • find the tyk gateway image: docker images|grep gateway (returns tykio/tyk-gateway)
  • run docker run -i -t tykio/tyk-gateway /bin/bash to get bash access to the docker… (took me a while to figure that out)
  • then you edit/view the tyk.conf file vi tyk.conf
  • the secret parameter is what I’m looking for
  • Finally you toss in the key into the header x-tyk-authorization when you make your rest calls

Although I was able to find the key I’m not sure how I would be able to set it. I think I can edit it in the docker and commit it but I feel like there should be a nicer way. I’m very new to docker so any advice or links would be appreciated for managing and manipulating these dockers particularly with getting this tyk config script to work on load? ideally I would have had the secret returned to me after the scritp setup along with the user name and password and ip that was provided but I’m betting others have not had as much difficulty as me.

Thanks for making an awesome and clear product, I really hope I’ll be able to continue chugging along and get this to work.

  • show quoted text -

Imported Google Group message.
Sender:Martin Buhr.
Date:Wednesday, 27 May 2015 08:36:13 UTC+1.

Hi Alex,

That certainly is a way to do it, though it defeatst he point of the container :slight_smile:

The trick with all of these configuration overrides is to use the -v mount option - e.g. (straight from the docker docs):

sudo docker run -d -P --name web -v /webapp training/webapp python

With the tyk gist you could change this line:

docker run -d --name tyk_gateway -p 8080:8080 --link tyk_redis:redis --link tyk_mongo:mongo tykio/tyk-gateway


docker run -d --name tyk_gateway -p 8080:8080 --link tyk_redis:redis --link tyk_mongo:mongo -v /etc/tyk/tyk.conf ./local/tyk.conf tykio/tyk-gateway

This will override the tyk.conf that the docker uses with your own so you can set your own secret keys and parameters. I wouldn;t moify it too much as it is tweaked for the container.


  • show quoted text -