README improved

This commit is contained in:
Juan Ferrer 2022-10-14 19:06:58 +02:00
parent dd9d7ea4b0
commit 856a36d02d
1 changed files with 17 additions and 16 deletions

View File

@ -2,43 +2,44 @@
Dockerfile and compose files used as basis for service deployment.
## Build and push an image
## Prepare environment
Full image name is made up of registry URL and image name.
```
fullImageName = [registryUrl]/[baseImageName]
registry=[registryUrl]
image=[imageName]
tag=[versionTag]
```
## Build and push an image
Build the image with *latest* tag.
```
$ docker build -t [fullImageName] [folder]
docker build -t $registry/$image $image
```
Tag the image with version.
```
$ docker tag [fullImageName] [fullImageName]:[tag]
docker tag $registry/$image $registry/$image:$tag
```
Test image locally
```
docker run --name test $registry/$image:$tag
```
Login into docker registry (If it's the first time or you are not saving credentials).
```
$ docker login [registryUrl]
docker login $registry
```
Push the *latest* image and version tag.
```
$ docker push [fullImageName]
$ docker push [fullImageName]:[tag]
docker push $registry/$image
docker push $registry/$image:$tag
```
Logout from docker registry (If you don't logout, credentials will remain saved
in your home directory).
```
$ docker logout [registryUrl]
docker logout $registry
```
## Test image locally
```
$ docker run -d --name [containerName] [registryUrl]/[imageName]:[tag]
```