vn-docker/README.md

46 lines
810 B
Markdown

# Docker
Dockerfile and compose files used as basis for service deployment.
## Prepare environment
```
registry=[registryUrl]
image=[imageName]
tag=[versionTag]
```
## Build and push an image
Build the image with *latest* tag.
```
docker build -t $registry/$image $image
```
Tag the image with version.
```
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 $registry
```
Push the *latest* image and version 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 $registry
```