Update README on running in Docker

Make the running in Docker section more clear by showing the actual
docker run command instead of only the utility.
This commit is contained in:
Sam Stoelinga 2020-03-16 18:49:27 -07:00
parent 23e3fe7486
commit bb76d8c3cc
1 changed files with 15 additions and 12 deletions

View File

@ -260,21 +260,24 @@ kaniko will build and push the final image in this build step.
Requirements: Requirements:
- [Docker](https://docs.docker.com/install/) - [Docker](https://docs.docker.com/install/)
- [gcloud](https://cloud.google.com/sdk/install)
We can run the kaniko executor image locally in a Docker daemon to build and push an image from a Dockerfile. We can run the kaniko executor image locally in a Docker daemon to build and push an image from a Dockerfile.
1. Load the executor image into the Docker daemon by running: For example, when using gcloud and GCR you could run Kaniko as follows:
```shell
docker run \
-v "$HOME"/.config/gcloud:/root/.config/gcloud \
-v /path/to/context:/workspace \
gcr.io/kaniko-project/executor:latest \
--dockerfile /workspace/Dockerfile
--destination "gcr.io/$PROJECT_ID/$IMAGE_NAME:$TAG"
--context dir:///workspace/"
```
```shell There is also a utility script [`run_in_docker.sh`](./run_in_docker.sh) that can be used as follows:
make images ```shell
``` ./run_in_docker.sh <path to Dockerfile> <path to build context> <destination of final image>
```
2. Run kaniko in Docker using [`run_in_docker.sh`](./run_in_docker.sh):
```shell
./run_in_docker.sh <path to Dockerfile> <path to build context> <destination of final image>
```
_NOTE: `run_in_docker.sh` expects a path to a _NOTE: `run_in_docker.sh` expects a path to a
Dockerfile relative to the absolute path of the build context._ Dockerfile relative to the absolute path of the build context._
@ -284,7 +287,7 @@ context in the local directory `/home/user/kaniko-project`, and a Google Contain
as a remote image destination: as a remote image destination:
```shell ```shell
./run_in_docker.sh /workspace/Dockerfile /home/user/kaniko-project gcr.io//<project-id>/<tag> ./run_in_docker.sh /workspace/Dockerfile /home/user/kaniko-project gcr.io/$PROJECT_ID/$TAG
``` ```
### Caching ### Caching