forked from Docker/baseimage-docker
Use COPY instead of ADD
While COPY and ADD are essentially interchangeable here, it is still considered good practice to use COPY whenever possible. From the docker docks on best practices: "Although ADD and COPY are functionally similar, generally speaking, COPY is preferred. That’s because it’s more transparent than ADD. [...] For other items (files, directories) that do not require ADD’s tar auto-extraction capability, you should always use COPY." Additionally, ADD commands were not cached prior to 0.7.3 (which was released on 2013-01-02).
This commit is contained in:
@@ -167,7 +167,7 @@ In `memcached.sh` (make sure this file is chmod +x):
|
||||
In `Dockerfile`:
|
||||
|
||||
RUN mkdir /etc/service/memcached
|
||||
ADD memcached.sh /etc/service/memcached/run
|
||||
COPY memcached.sh /etc/service/memcached/run
|
||||
|
||||
Note that the shell script must run the daemon **without letting it daemonize/fork it**. Usually, daemons provide a command line flag or a config file option for that.
|
||||
|
||||
@@ -191,7 +191,7 @@ In `logtime.sh` (make sure this file is chmod +x):
|
||||
In `Dockerfile`:
|
||||
|
||||
RUN mkdir -p /etc/my_init.d
|
||||
ADD logtime.sh /etc/my_init.d/logtime.sh
|
||||
COPY logtime.sh /etc/my_init.d/logtime.sh
|
||||
|
||||
<a name="environment_variables"></a>
|
||||
### Environment variables
|
||||
@@ -456,7 +456,7 @@ Instructions for logging in the container is the same as in section [Using the i
|
||||
Edit your Dockerfile to install an SSH public key:
|
||||
|
||||
## Install an SSH of your choice.
|
||||
ADD your_key.pub /tmp/your_key.pub
|
||||
COPY your_key.pub /tmp/your_key.pub
|
||||
RUN cat /tmp/your_key.pub >> /root/.ssh/authorized_keys && rm -f /tmp/your_key.pub
|
||||
|
||||
Then rebuild your image. Once you have that, start a container based on that image:
|
||||
|
||||
Reference in New Issue
Block a user