48 lines
813 B
Markdown
48 lines
813 B
Markdown
# Docker
|
|
|
|
Dockerfile and compose files used as basis for service deployment.
|
|
|
|
## Prepare environment
|
|
|
|
```
|
|
registry=[registryUrl]
|
|
image=[imageName]
|
|
tag=[versionTag]
|
|
```
|
|
|
|
## Build 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
|
|
```
|
|
|
|
## Push image
|
|
|
|
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
|
|
```
|