我正在将容器ID存储在数据库中,基于此,我会定期检查容器是否仍在运行或已停止使用“ Docker Inspect”,我会在数据库中更新此信息。
如果我只想更新状态但有人要更改环境,则上述方法很好。变量,并使用docker run命令创建容器,然后生成新的容器ID。
所以我的问题是,是否有可能使用以前的容器ID生成新的docker容器?
答案 0 :(得分:0)
运行容器时,似乎没有“手动”设置UUID的选项。这是Docker Daemon要做的事情。
Container identification
操作员可以通过三种方式识别容器:
library(magrittr) library(dplyr) mtcars %>% # rename the variables for easier generalisation to other data frames rename(x = gear, y = cyl, group = carb) %>% # keep only the max y value for each dodged bar; we don't want additional # points group_by(x, group) %>% summarise(y = max(y)) %>% ungroup() %>% ggplot(aes(x = x, y = y, group = group)) + geom_col(position = position_dodge(width = 0.9)) + # create invisible point layer that captures the dodged x values, while keeping # the values at each x point a different colour, so that we can identify points # that belonged to the same x value for joining later geom_point(aes(color = x), position = position_dodge(width = 0.9), alpha = 0, show.legend = FALSE) + theme_bw() -> p p + geom_line(data = layer_data(p, 2L), aes(x = x, y = y, group = colour), color = "red", size = 2)
UUID标识符来自Docker守护程序。如果未使用
| Identifier type | Example value | |===========================================================================================| | UUID long identifier | "f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778"| | UUID short identifier | "f78375b1c487" | | Name | "evil_ptolemy" |
选项分配容器名称,则该守护程序会为您生成一个随机字符串名称。定义--name
是向容器添加含义的便捷方法。如果指定name
,则可以在Docker网络中引用容器时使用它。这适用于背景和前景Docker容器。