How do I pass environment variables to Docker containers?

I’m new to Docker, and it’s unclear how to access an external database from a container. Is the best way to hard-code in the connection string? # Dockerfile ENV DATABASE_URL amazon:rds/connection?string 16 s 16 You can pass environment variables to your containers with the -e flag. An example from a startup script: sudo docker run … Read more

What is the difference between the ‘COPY’ and ‘ADD’ commands in a Dockerfile?

What is the difference between the COPY and ADD commands in a Dockerfile, and when would I use one over the other? COPY <src> <dest> The COPY instruction will copy new files from <src> and add them to the container’s filesystem at path <dest> ADD <src> <dest> The ADD instruction will copy new files from … Read more