Skip to content

Commit

Permalink
faq
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmota committed Feb 16, 2019
1 parent faa4525 commit c0fc4ff
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
17 changes: 16 additions & 1 deletion README.md
Expand Up @@ -23,6 +23,7 @@
- [Getting started](#getting-started)
- [CLI](#cli)
- [Test](#test)
- [FAQ](#faq)
- [Contributing](#contributing)
- [License](#license)

Expand Down Expand Up @@ -178,7 +179,7 @@ go install github.com/miguelmota/ipdr/cmd/ipdr
### TLDR; example

```bash
# build docker image
# build Docker image
docker build -t example/helloworld .

# push to IPFS
Expand Down Expand Up @@ -222,6 +223,20 @@ Use "ipdr [command] --help" for more information about a command.
make test
```

## FAQ

- Q: How can I configure the local registry host or port that ipdr uses when pushing or pulling Docker images?

- A: Use the `--docker-registry-host` flag, eg. `--docker-registry-host docker.for.mac.local:5000`

- Q: How can I configure the ipfs host that ipdr uses for pushing or pulling Docker images?

- A: Use the `--ipfs-host` flag, eg. `--ipfs-host 127.0.0.1:5001`

- Q: How can I configure the port for the ipdr server?

- A: Use the `--port` flag, eg. `--port 5000`

## Contributing

Pull requests are welcome!
Expand Down
6 changes: 4 additions & 2 deletions cmd/ipdr/main.go
Expand Up @@ -82,8 +82,8 @@ More info: https://github.com/miguelmota/ipdr`,
},
}

pushCmd.Flags().StringVarP(&ipfsHost, "ipfs-host", "", "127.0.0.1:5001", "A remote IPFS API host to push the image to. Eg. 127.0.0.1:5001")
pushCmd.Flags().BoolVarP(&silent, "silent", "s", false, "Silent flag suppresses logs and outputs only IPFS hash")
pushCmd.Flags().StringVarP(&ipfsHost, "ipfs-host", "", "127.0.0.1:5001", "A remote IPFS API host to push the image to. Eg. 127.0.0.1:5001")
pushCmd.Flags().StringVarP(&dockerRegistryHost, "docker-registry-host", "", "docker.localhost:5000", "The Docker local registry host. Eg. 127.0.0.1:5000 Eg. docker.localhost:5000")

pullCmd := &cobra.Command{
Expand All @@ -103,7 +103,8 @@ More info: https://github.com/miguelmota/ipdr`,
RunE: func(cmd *cobra.Command, args []string) error {
reg := registry.NewRegistry(&registry.Config{
DockerLocalRegistryHost: dockerRegistryHost,
Debug: !silent,
IPFSHost: ipfsHost,
Debug: !silent,
})

imageHash := args[0]
Expand All @@ -122,6 +123,7 @@ More info: https://github.com/miguelmota/ipdr`,
}

pullCmd.Flags().BoolVarP(&silent, "silent", "s", false, "Silent flag suppresses logs and outputs only Docker repo tag")
pushCmd.Flags().StringVarP(&ipfsHost, "ipfs-host", "", "127.0.0.1:5001", "A remote IPFS API host to pull the image from. Eg. 127.0.0.1:5001")
pullCmd.Flags().StringVarP(&dockerRegistryHost, "docker-registry-host", "", "docker.localhost:5000", "The Docker local registry host. Eg. 127.0.0.1:5000 Eg. docker.localhost:5000")

serverCmd := &cobra.Command{
Expand Down
6 changes: 5 additions & 1 deletion example/example.sh
@@ -1,12 +1,16 @@
#!/bin/bash

# build Docker image
docker build -t example/helloworld .

# test run
docker run example/helloworld:latest

# push to IPFS
IPFS_HASH="$(ipdr push example/helloworld --silent)"

# pull from IPFS
REPO_TAG=$(ipdr pull "$IPFS_HASH" --silent)

# run image pulled from IPFS
docker run "$REPO_TAG"

0 comments on commit c0fc4ff

Please sign in to comment.