Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 0ba9761

Browse files
committed
Creating tmp directory for certs search
1 parent 12a7d56 commit 0ba9761

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ type MultiVersionInfo struct {
226226

227227
To run container-diff on image IDs, docker must be installed.
228228

229-
If encountering this error ```open /etc/docker/certs.d/gcr.io: permission
230-
denied```, run ```sudo rm -rf /etc/docker```.
231229

232230
## Example Run
233231

utils/image_prep_utils.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,15 @@ func (p CloudPrepper) getFileSystem() (string, error) {
116116
if err != nil {
117117
panic(err)
118118
}
119-
119+
120+
// By default, the image library will try to look at /etc/docker/certs.d
121+
// As a non-root user, this would result in a permissions error, so we avoid this
122+
// by looking in a temporary directory we create in the container-diff home directory
120123
cwd, _ := os.Getwd()
124+
tmpCerts, _ := ioutil.TempDir(cwd, "certs")
125+
defer os.RemoveAll(tmpCerts)
121126
ctx := &types.SystemContext{
122-
DockerCertPath: cwd,
127+
DockerCertPath: tmpCerts,
123128
}
124129
img, err := ref.NewImage(ctx)
125130
if err != nil {
@@ -162,9 +167,14 @@ func (p CloudPrepper) getConfig() (ConfigSchema, error) {
162167
return ConfigSchema{}, err
163168
}
164169

170+
// By default, the image library will try to look at /etc/docker/certs.d
171+
// As a non-root user, this would result in a permissions error, so we avoid this
172+
// by looking in a temporary directory we create in the container-diff home directory
165173
cwd, _ := os.Getwd()
174+
tmpCerts, _ := ioutil.TempDir(cwd, "certs")
175+
defer os.RemoveAll(tmpCerts)
166176
ctx := &types.SystemContext{
167-
DockerCertPath: cwd,
177+
DockerCertPath: tmpCerts,
168178
}
169179
img, err := ref.NewImage(ctx)
170180
if err != nil {

0 commit comments

Comments
 (0)