fix: use named volumes for deployment
- Replace local config mount with named volume - Include config.yml content in Dockerfile - Remove dependency on local files
This commit is contained in:
22
Dockerfile
22
Dockerfile
@@ -3,5 +3,23 @@ FROM registry:2
|
|||||||
# Use Alpine's apk package manager to install apache2-utils
|
# Use Alpine's apk package manager to install apache2-utils
|
||||||
RUN apk --no-cache add apache2-utils
|
RUN apk --no-cache add apache2-utils
|
||||||
|
|
||||||
# Create config directory
|
# Create config directory and add default config
|
||||||
RUN mkdir -p /etc/docker/registry/
|
RUN mkdir -p /etc/docker/registry/ && \
|
||||||
|
echo 'version: 0.1\n\
|
||||||
|
log:\n\
|
||||||
|
fields:\n\
|
||||||
|
service: registry\n\
|
||||||
|
storage:\n\
|
||||||
|
cache:\n\
|
||||||
|
blobdescriptor: inmemory\n\
|
||||||
|
filesystem:\n\
|
||||||
|
rootdirectory: /var/lib/registry\n\
|
||||||
|
http:\n\
|
||||||
|
addr: :5000\n\
|
||||||
|
headers:\n\
|
||||||
|
X-Content-Type-Options: [nosniff]\n\
|
||||||
|
health:\n\
|
||||||
|
storagedriver:\n\
|
||||||
|
enabled: true\n\
|
||||||
|
interval: 10s\n\
|
||||||
|
threshold: 3' > /etc/docker/registry/config.yml
|
||||||
@@ -9,9 +9,7 @@ services:
|
|||||||
- "5000"
|
- "5000"
|
||||||
volumes:
|
volumes:
|
||||||
- registry-data:/var/lib/registry
|
- registry-data:/var/lib/registry
|
||||||
- type: bind
|
- registry-config:/etc/docker/registry
|
||||||
source: ./config.yml
|
|
||||||
target: /etc/docker/registry/config.yml
|
|
||||||
networks:
|
networks:
|
||||||
- registry-network
|
- registry-network
|
||||||
|
|
||||||
@@ -22,3 +20,5 @@ networks:
|
|||||||
volumes:
|
volumes:
|
||||||
registry-data:
|
registry-data:
|
||||||
driver: local
|
driver: local
|
||||||
|
registry-config:
|
||||||
|
driver: local
|
||||||
Reference in New Issue
Block a user