Skip to content
On this page

docker中的ubuntu修改主机名


标签:docker/tip  

默认启动是随机的主机命名,需要在启动的时候添加一个 --cap-add SYS_ADMIN

Is there any way to use hostname command in the container? · Issue #8902 · moby/moby (github.com)

bash
sudo docker run --cap-add SYS_ADMIN --name u18 -it -v ~/:/host-home ubuntu:18.04 /bin/bash

Last updated: