mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Document that ENV vars are not automatically updated
Unlike the entries in `/etc/hosts`, environment-variables for linked containers are not automatically updated if the linked container is restarted. This adds a note to the documentation in; https://docs.docker.com/userguide/dockerlinks/#environment-variables and https://docs.docker.com/reference/run/#env-environment-variables To make users aware that this is the case and recommends them to use the `/etc/hosts` entries in stead. I added this change because users were expecting environment variables to be updated automatically as well (https://github.com/docker/docker/issues/10164). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
		
							parent
							
								
									467b7c8213
								
							
						
					
					
						commit
						3fb06dc104
					
				
					 2 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -647,6 +647,12 @@ mechanism to communicate with a linked container by its alias:
 | 
				
			||||||
If you restart the source container (`servicename` in this case), the recipient
 | 
					If you restart the source container (`servicename` in this case), the recipient
 | 
				
			||||||
container's `/etc/hosts` entry will be automatically updated.
 | 
					container's `/etc/hosts` entry will be automatically updated.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> **Note**:
 | 
				
			||||||
 | 
					> Unlike host entries in the `/ets/hosts` file, IP addresses stored in the
 | 
				
			||||||
 | 
					> environment variables are not automatically updated if the source container is
 | 
				
			||||||
 | 
					> restarted. We recommend using the host entries in `/etc/hosts` to resolve the
 | 
				
			||||||
 | 
					> IP address of linked containers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## VOLUME (shared filesystems)
 | 
					## VOLUME (shared filesystems)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    -v=[]: Create a bind mount with: [host-dir]:[container-dir]:[rw|ro].
 | 
					    -v=[]: Create a bind mount with: [host-dir]:[container-dir]:[rw|ro].
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -232,6 +232,12 @@ command to list the specified container's environment variables.
 | 
				
			||||||
> container. Similarly, some daemons (such as `sshd`)
 | 
					> container. Similarly, some daemons (such as `sshd`)
 | 
				
			||||||
> will scrub them when spawning shells for connection.
 | 
					> will scrub them when spawning shells for connection.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> **Note**:
 | 
				
			||||||
 | 
					> Unlike host entries in the [`/ets/hosts` file](#updating-the-etchosts-file),
 | 
				
			||||||
 | 
					> IP addresses stored in the environment variables are not automatically updated
 | 
				
			||||||
 | 
					> if the source container is restarted. We recommend using the host entries in
 | 
				
			||||||
 | 
					> `/etc/hosts` to resolve the IP address of linked containers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You can see that Docker has created a series of environment variables with
 | 
					You can see that Docker has created a series of environment variables with
 | 
				
			||||||
useful information about the source `db` container. Each variable is prefixed with
 | 
					useful information about the source `db` container. Each variable is prefixed with
 | 
				
			||||||
`DB_`, which is populated from the `alias` you specified above. If the `alias`
 | 
					`DB_`, which is populated from the `alias` you specified above. If the `alias`
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue