Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Services are confused with certain container names and links #2334

Closed
dprunier opened this issue Apr 25, 2018 · 1 comment
Closed

Services are confused with certain container names and links #2334

dprunier opened this issue Apr 25, 2018 · 1 comment
Assignees
Milestone

Comments

@dprunier
Copy link

RancherOS Version: 1.3.0

Where are you running RancherOS? qemu

When create linked services with certain names (??!), Rancher OS gets confused and doesn't match appropriate containers with services and try to recreate them with an invalid name.

For example, if I define services like this in /var/lib/rancher/conf/services.yml:

container1:
  image: centos:6
  command: sleep infinity
  restart: always

container:
  image: centos:7
  command: sleep infinity
  restart: always
  links:
    - container1

After I run ros service up container1 ; ros service up container, to start the two service, the next time I try to start container1 again, it fails with this very cryptic message:

DEBU[0000] Opening compose files:                       
DEBU[0000] [0/1] [docker]: Adding                       
DEBU[0000] [0/1] [ntp]: Adding                          
DEBU[0000] [0/2] [all-volumes]: Adding                  
DEBU[0000] [0/4] [console]: Adding                      
DEBU[0000] [0/4] [network]: Adding                      
DEBU[0000] [0/5] [udev-cold]: Adding                    
DEBU[0000] [0/7] [cloud-init-execute]: Adding           
DEBU[0000] [0/7] [media-volumes]: Adding                
DEBU[0000] [0/8] [logrotate]: Adding                    
DEBU[0000] [0/10] [preload-user-images]: Adding         
DEBU[0000] [0/10] [syslog]: Adding                      
DEBU[0000] [0/11] [system-cron]: Adding                 
DEBU[0000] [0/13] [user-volumes]: Adding                
DEBU[0000] [0/13] [command-volumes]: Adding             
DEBU[0000] [0/14] [container-data-volumes]: Adding      
DEBU[0000] [0/16] [udev]: Adding                        
DEBU[0000] [0/16] [acpid]: Adding                       
DEBU[0000] [0/17] [system-volumes]: Adding              
DEBU[0000] Loaded /var/lib/rancher/conf/services.yml from /var/lib/rancher/conf/services.yml 
DEBU[0000] [0/19] [container]: Adding                   
DEBU[0000] [0/19] [container1]: Adding                  
INFO[0000] Project [os]: Starting project               
DEBU[0000] Using /proc/version to set rancher.environment.KERNEL_VERSION = 4.9.80-rancher 
DEBU[0000] Using /proc/version to set rancher.environment.KERNEL_VERSION = 4.9.80-rancher 
DEBU[0000] Using /proc/version to set rancher.environment.KERNEL_VERSION = 4.9.80-rancher 
DEBU[0000] Using /proc/version to set rancher.environment.KERNEL_VERSION = 4.9.80-rancher 
DEBU[0000] Using /proc/version to set rancher.environment.KERNEL_VERSION = 4.9.80-rancher 
DEBU[0000] Using /proc/version to set rancher.environment.KERNEL_VERSION = 4.9.80-rancher 
DEBU[0000] [0/20] [user-volumes]: Ignoring              
DEBU[0000] [0/20] [command-volumes]: Ignoring           
DEBU[0000] [0/20] [system-volumes]: Ignoring            
DEBU[0000] [0/20] [logrotate]: Ignoring                 
DEBU[0000] [0/20] [system-cron]: Ignoring               
DEBU[0000] [0/20] [udev-cold]: Ignoring                 
DEBU[0000] [0/20] [udev]: Ignoring                      
DEBU[0000] [0/20] [container-data-volumes]: Ignoring    
DEBU[0000] [0/20] [media-volumes]: Ignoring             
DEBU[0000] [0/20] [all-volumes]: Ignoring               
DEBU[0000] [0/20] [network]: Ignoring                   
DEBU[0000] [0/20] [ntp]: Ignoring                       
DEBU[0000] [0/20] [cloud-init-execute]: Ignoring        
DEBU[0000] [0/20] [console]: Ignoring                   
DEBU[0000] [0/20] [preload-user-images]: Ignoring       
DEBU[0000] [0/20] [docker]: Ignoring                    
DEBU[0000] [0/20] [acpid]: Ignoring                     
DEBU[0000] Launching action for container1              
DEBU[0000] [0/20] [syslog]: Ignoring                    
DEBU[0000] [0/20] [container]: Ignoring                 
INFO[0000] [0/20] [container1]: Starting                
DEBU[0000] Images for container/ do not match centos:7!=centos:6 
DEBU[0000] Going to decide if recreate is needed         ForceRecreate=false NoRecreate=false outOfSync=true
INFO[0000] Recreating container1                        
DEBU[0000] Renaming container => container_9cad29d4f4cd 
DEBU[0000] Creating container container/ &docker.ConfigWrapper{Config:(*container.Config)(0xc420481560), HostConfig:(*container.HostConfig)(0xc4203bc380), NetworkingConfig:(*network.NetworkingConfig)(nil)} 
DEBU[0000] Failed to create container container/: Error response from daemon: Invalid container name (container/), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed 
ERRO[0000] Failed Starting container1 : Error response from daemon: Invalid container name (container/), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed 
ERRO[0000] Failed to start: container1 : Error response from daemon: Invalid container name (container/), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed 
Error response from daemon: Invalid container name (container/), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed

The most surprising part is that it doesn't seems to happen if containers are not linked and even more surprising, it seems to depend on the service names. For example, I cannot reproduce if i'm using container1 and container2 as service names.

@kingsd041
Copy link
Contributor

@dprunier thank you for the bug report!
Fixed in rancheros v1.4.0-rc2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants