vn-docker/README.md

46 lines
810 B
Markdown
Raw Normal View History

# Docker
2020-01-07 09:22:41 +00:00
2020-01-07 11:14:08 +00:00
Dockerfile and compose files used as basis for service deployment.
2020-01-16 14:09:47 +00:00
2022-10-14 17:06:58 +00:00
## Prepare environment
2020-01-16 14:09:47 +00:00
```
2022-10-14 17:06:58 +00:00
registry=[registryUrl]
image=[imageName]
tag=[versionTag]
2020-01-16 14:09:47 +00:00
```
2022-10-14 17:06:58 +00:00
## Build and push an image
Build the image with *latest* tag.
```
2022-10-14 17:06:58 +00:00
docker build -t $registry/$image $image
```
Tag the image with version.
```
2022-10-14 17:06:58 +00:00
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).
2020-01-16 14:09:47 +00:00
```
2022-10-14 17:06:58 +00:00
docker login $registry
2020-01-16 14:09:47 +00:00
```
Push the *latest* image and version tag.
2020-01-16 14:09:47 +00:00
```
2022-10-14 17:06:58 +00:00
docker push $registry/$image
docker push $registry/$image:$tag
2020-01-16 14:09:47 +00:00
```
2020-01-24 10:55:05 +00:00
Logout from docker registry (If you don't logout, credentials will remain saved
in your home directory).
2020-01-16 14:09:47 +00:00
```
2022-10-14 17:06:58 +00:00
docker logout $registry
2020-01-16 14:09:47 +00:00
```