Access tyk-gateway after setup with docker


#1

How do I access the tyk-gateway container after I setup tyk with docker? Also, if I am using a file based approach to create apis, is it possible to build a docker image with the files I have added?


#2

If you want to enter into the tyk-gateway container, you’ll want to run:

docker exec -it [container_id] /bin/bash

that will start the bash shell in your tyk-gateway container. You can find the container id with “docker ps” like so:

$ docker ps
CONTAINER ID        IMAGE                                 COMMAND                  CREATED             STATUS              PORTS                                                                  NAMES
19418812609a        tykio/tyk-gateway:latest              "/opt/tyk-gateway/tyk"   25 hours ago        Up 3 hours          0.0.0.0:3010->3010/tcp, 0.0.0.0:8080->8080/tcp, 0.0.0.0:80->8080/tcp   tykquickstart_tyk_gateway_1
a0ed852b5c2f        tykio/tyk-dashboard:latest            "/opt/tyk-dashboard/t"   26 hours ago        Up 26 hours         0.0.0.0:3000->3000/tcp, 0.0.0.0:5000->5000/tcp                         tykquickstart_tyk_dashboard_1
224f7f5eb54b        tykio/tyk-pump-docker-pub:latest      "/opt/tyk-pump/tyk-pu"   7 days ago          Up 6 days                                                                                  tykquickstart_tyk_pump_1
fdcc4ee31613        redis:latest                          "/entrypoint.sh redis"   7 days ago          Up 6 days           0.0.0.0:6379->6379/tcp                                                 tykquickstart_tyk_redis_1
58f928039397        mongo:latest                          "/entrypoint.sh mongo"   7 days ago          Up 6 days           0.0.0.0:27017->27017/tcp                                               tykquickstart_tyk_mongo_1

Note: The gateway container is a reverse proxy so there’s no UI. That’s part of the dashboard container and accessible on http://localhost:3000

If you’re on Mac w/ boot2docker / docker-machine, you’ll have to use the VM’s IP rather than localhost.

After editing a container you can create a new image based on that container using “docker commit”. See the docs here: https://docs.docker.com/engine/reference/commandline/commit/


#3

Thanks so much for your response. Really helpful! One more thing, how do I access the tyk log files?


#4

Tyk log files in docker are just the output of the docker container, so you want to use:

docker logs --tail=100 --follow {container-name}