88- ` 2.2.2 ` [ (2.2/Dockerfile)] ( https://github.com/rodolpheche/wiremock-docker/blob/2.2.2/Dockerfile )
99- ` 2.1.12 ` [ (2.1/Dockerfile)] ( https://github.com/rodolpheche/wiremock-docker/blob/2.1.12/Dockerfile )
1010
11- ## How to use this image
12-
13- #### The image include
11+ ## The image includes
1412
1513- ` EXPOSE 8080 8081 ` : the wiremock http/https server port
1614- ` VOLUME /home/wiremock ` : the wiremock data storage
1715
18- ##### Launch a Wiremock container
16+ ## How to use this image
17+
18+ #### Environment variables
19+
20+ - ` uid ` : the container executor uid, useful to avoid file creation owned by root
21+
22+ #### Getting started
23+
24+ ##### Start a Wiremock container
1925
2026``` sh
21- mkdir stub
22- docker run -d -v $PWD /stub:/home/wiremock -p 8080:8080 rodolpheche/wiremock
27+ docker run -it --rm -p 8080:8080 rodolpheche/wiremock
2328```
2429
25- > Simply access [ http://localhost:8080/__admin ] ( http://localhost:8080/__admin ) to display your mappings (empty set)
30+ > Access [ http://localhost:8080/__admin ] ( http://localhost:8080/__admin ) to display the mappings (empty set)
2631
27- ##### Launch a Hello World container
32+ ##### Start a Hello World container
2833
2934``` sh
3035git clone https://github.com/rodolpheche/wiremock-docker.git
@@ -33,14 +38,46 @@ docker run -it --rm -v $PWD/wiremock-docker/sample:/home/wiremock -p 8080:8080 r
3338
3439> Access [ http://localhost:8080/hello ] ( http://localhost:8080/hello ) to show Hello World message
3540
36- ##### Launch a Wiremock container with Wiremock arguments
41+ ##### Start a Wiremock container with Wiremock arguments
42+
43+ ** !! WARNING !!** WIREMOCK_ARGS environment variable is now deprecated, it will be removed in a future version
44+
45+ ``` sh
46+ # !! DEPRECATED !!
47+ docker run -it --rm -p 8081:8081 -e WIREMOCK_ARGS=" --https-port 8081" rodolpheche/wiremock
48+ # !! DEPRECATED !!
49+ ```
50+
51+ Instead, you should now use docker container arguments :
3752
3853``` sh
39- docker run -d - p 8081:8081 -e WIREMOCK_ARGS= " --https-port 8081" rodolpheche/wiremock
54+ docker run -it --rm - p 8081:8081 rodolpheche/wiremock --https-port 8081 --verbose
4055```
4156
4257> Access [ https://localhost:8081/__admin ] ( https://localhost:8081/__admin ) to to check https working
4358
44- #### Known issues
59+ ##### Start a Bash session from a container
60+
61+ ``` sh
62+ docker run -d -p 8080:8080 --name rodolpheche-wiremock-container rodolpheche/wiremock
63+ docker exec -it rodolpheche-wiremock-container bash
64+ echo $WIREMOCK_VERSION
65+ exit # exit container
66+ docker rm -f rodolpheche-wiremock-container
67+ ```
68+
69+
70+
71+ ##### Start record mode using host uid for file creation
72+
73+ In Record mode, when binding host folders (ex. $PWD/test) with the container volume (/home/wiremock), the created files will be owned by root, which is, in most cases, undesired.
74+ To avoid this, you can use the ` uid ` docker environment variable to also bind host uid with the container executor uid.
75+
76+ ``` sh
77+ docker run -d -p 8080:8080 --name rodolpheche-wiremock-container -v $PWD /test:/home/wiremock -e uid=$( id -u) rodolpheche/wiremock --proxy-all=" http://registry.hub.docker.com" --record-mappings --verbose
78+ curl http://localhost:8080
79+ docker rm -f rodolpheche-wiremock-container
80+ ```
4581
46- - getting permission error with binded $PWD folder if ** host uid executor != 1000**
82+ > Check the created file owner with ` ls -alR test `
83+
0 commit comments