-
-
Save aaronfeng/f4894f3b66be8d153808 to your computer and use it in GitHub Desktop.
Examples of Docker ADD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ├── Dockerfile | |
## ├── backend | |
## │ ├── service | |
## │ └── service.config | |
## ├── backend.tar.gz | |
## └── frontend | |
## ├── app | |
## └── app.config | |
FROM debian:8.0 | |
RUN mkdir -p /app/backend | |
# src dir context is where docker build is run from | |
# | |
# 1. single source into a file | |
ADD backend/service /app/backend/service | |
ADD backend/service.config /app/backend/service.config | |
# 2. single source into a directory | |
ADD backend/service /app/backend/ | |
ADD backend/service.config /app/backend/ | |
# 3. multiple sources | |
ADD backend/service backend/service.config /app/backend/ | |
# 4. use wildcard | |
ADD backend/service* /app/backend/ | |
# 5. using Go's filepath.Match http://golang.org/pkg/path/filepath/#Match | |
ADD backend/?ervice* /app/backend/ | |
# 6. content of backend/ is copied not the dir | |
ADD backend /app/backend/ | |
# 7. using external url | |
ADD http://aaronfeng.com/backend.tar.gz /app/backend/foo.tar.gz | |
# 8. using external url, /app/backend/backend.tar.gz | |
ADD http://aaronfeng.com/backend.tar.gz /app/backend/ | |
# NOTE: ADD does not support auth | |
# RUN curl ... | |
# 9. output tar's structure into destination. gzip, bzip2 | |
# | |
# backend.tar.gz | |
# backend/ | |
# backend/service | |
# backend/service.config | |
ADD backend.tar.gz /app | |
# 10. Add an install script then RUN it. | |
ADD install.sh /app | |
RUN /app/install.sh | |
CMD ls /app/backend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment