8
8
- ` 2.2.2 ` [ (2.2/Dockerfile)] ( https://github.com/rodolpheche/wiremock-docker/blob/2.2.2/Dockerfile )
9
9
- ` 2.1.12 ` [ (2.1/Dockerfile)] ( https://github.com/rodolpheche/wiremock-docker/blob/2.1.12/Dockerfile )
10
10
11
- ## How to use this image
12
-
13
- #### The image include
11
+ ## The image includes
14
12
15
13
- ` EXPOSE 8080 8081 ` : the wiremock http/https server port
16
14
- ` VOLUME /home/wiremock ` : the wiremock data storage
17
15
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
19
25
20
26
``` 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
23
28
```
24
29
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)
26
31
27
- ##### Launch a Hello World container
32
+ ##### Start a Hello World container
28
33
29
34
``` sh
30
35
git 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
33
38
34
39
> Access [ http://localhost:8080/hello ] ( http://localhost:8080/hello ) to show Hello World message
35
40
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 :
37
52
38
53
``` 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
40
55
```
41
56
42
57
> Access [ https://localhost:8081/__admin ] ( https://localhost:8081/__admin ) to to check https working
43
58
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
+ ```
45
81
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