# Docker

Dockerfile and compose files used as basis for service deployment.

## Build and push an image

Full image name is made up of registry URL and image name.
```
fullImageName = [registryUrl]/[baseImageName]
```

Build the image with *latest* tag.
```
$ docker build -t [fullImageName] [folder]
```

Tag the image with version.
```
$ docker tag [fullImageName] [fullImageName]:[tag]
```

Login into docker registry (If it's the first time or you are not saving credentials).
```
$ docker login [registryUrl]
```

Push the *latest* image and version tag.
```
$ docker push [fullImageName]
$ docker push [fullImageName]:[tag]
```

Logout from docker registry (If you don't logout, credentials will remain saved
in your home directory).
```
$ docker logout [registryUrl]
```

## Test image locally

```
$ docker run -d --name [containerName] [registryUrl]/[imageName]:[tag]
```

