Sign inSign up

cl3m3nt/api-rest-docker

By cl3m3nt

•Updated over 8 years ago

Deploy docker container with Go rest api

Image
0

1.1K

cl3m3nt/api-rest-docker repository overview

⁠api-rest-docker

Docker Automated buil Docker Build Statu Docker Pulls

Deploy docker container with Go rest api

⁠Library used

⁠Environment variables

VariabeValueDescription
xtoken1234xToken API

⁠Run

docker build -t cl3m3nt/api-rest-docker  .
docker run -it -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock -e xtoken=0000 cl3m3nt/api-rest-docker

⁠Deploy with API

curl -X POST --header 'Content-Type: application/json' --header 'X-AUTH-TOKEN: 0000' -d '{
    "Image": "httpd:alpine",
    "ExposedPorts": {
        "80/tcp" : {}
    },
  "HostConfig":{
    "PortBindings": {
              "80/tcp": [
                  {
                      "HostIp": "0.0.0.0",
                      "HostPort": "80"
                  }
              ]
          }
  },
  "Hostname": "coucou",
  "Env": [
                "test=coucou"
    ]
}' http://localhost:8080/deploy
curl -X POST --header 'Content-Type: application/json' --header 'X-AUTH-TOKEN: 1234' -d '{
    "Image": "nginx",
    "Env": [
                "VIRTUAL_NETWORK=nginx-proxy",
                "LETSENCRYPT_HOST=test.mydomain.com",
                "[email protected]",
                "VIRTUAL_HOST=test.mydomain.com",
                "VIRTUAL_PORT=80"
            ],
  "HostConfig":{
    "PortBindings": {}
  }
  "Hostname": "test"
}' http://localhost:8080/deploy

Tag summary

Content type

Image

Digest

Size

298.7 MB

Last updated

over 8 years ago

docker pull cl3m3nt/api-rest-docker