Change hostname and container name in Synology Docker

I am not able to change hostname!

Yes, you can change the name of the container, but that's it, no useful.
Even the command hostname fails. You are stuck with the initial name when you created the container. Sad....

What's required?

Yes, here is the solution and it requires shell access with root privilege. You may SSH to the box with admin and sudo root.

Four steps

  1. locate container ID and content directory
  2. shutdown Docker service
  3. manually change them in config files
  4. start Docker service
Once again, with root!

0.
Change the container name in web UI console first if necessary.

1. 
# docker ps -a
Find the container ID in the 1st column.

# docker inspect <container_id> | grep Path
You will see the file path, a very long one, like this one, the blue part is the directory.
        "HostnamePath": "/volume1/@docker/containers/0fbc2a4f6caf4f9337ds82e6dc57857514490a459e28054c1f616e2a9742bb35/hostname",

cd to that directory.

2.
# synpkgctl stop Docker
stop the Docker service. All container will be STOPPED!!!

3.
three files are config.v2.json, hostname, hosts
Manually substitute them in the file.

4. 
# synpkgctl start Docker

Reference


Comments

Popular posts from this blog

DELL U4320Q ddccontrol in Linux switch input

UEFI boot.