TL;DR
Is there any way I can get docker-compose to work with TFS Git URIs?
I have written a simple docker-compose.yml that pulls from a repository containing a dockerfile and builds an image.
version: '3.4'
services:
ubuntu:
image: ubuntu-fromrepo
build:
context: https://github.com/dockerfile/ubuntu.git
dockerfile: Dockerfile
When you run this with:
docker-compose up --build
it will automatically pull the git repository (master branch), build the ubuntu image and run it.
I have a repository on TFS with a dockerfile that works when you pull it manually and run it. So, git clone ... to clone the repo, docker build . to build the image and then docker run -it ubuntu:14.04 (for example with the same repo pulled as above in TFS).
However, the docker-compose method that I used above does not work as the Git URI for TFS fails to resolve. It expects a HTTPS Git URI ("https://server-name/repository-name.git") but in TFS, Git URIs are in the format ("https://server-name/tfs/Default/project-name/_git/repository-name").
docker-compose fails to resolve this URI and outputs this error:
Service '...' failed to build: {'message': 'error downloading remote context http://.../tfs/Default/.../_git/...: failed to GET http://.../tfs/Default/.../_git/... with status 401 Unauthorized: \r\n ...
The HTML is just an error page with the following error code :
Full HTML here.
TF400813: Resource not available for anonymous access. Client authentication required.
Is there any way I can get docker-compose to work with TFS Git URIs?
UPDATE:
I have tested it with the tokenized URI:
git clone https://token@servername/tfs/Default/projectname/_git/repositoryname
which works, but using the same URI in the docker-compose.yml file does not - gives this error:
ERROR: compose.cli.errors.log_api_error: error detecting content type for remote http://...@.../tfs/Default/.../_git/...: unsupported Content-Type "text/html; charset=utf-8"`
I think this is just returning the error page on TFS for an inaccessible resource?