Docker掛載/etc/timezone報錯問題
Docker掛載/etc/timezone報錯
執(zhí)行這段命令
docker run -d --name sys-app -v /etc/timezone:/etc/timezone -v /etc/localtime:/etc/localtime -p 8001:8001 --restart=always --net=host sys-app:latest
報如下錯
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346:
starting container process caused "process_linux.go:449: container init caused
\"rootfs_linux.go:58: mounting \\\"/etc/timezone\\\" to rootfs
\\\"/var/lib/docker/overlay2/cb6229f54bfa2ffb1fdb70a316606bf5936ebe69c7d0ee8d26da98b78c9
1e857/merged\\\" at
\\\"/var/lib/docker/overlay2/cb6229f54bfa2ffb1fdb70a316606bf5936ebe69c7d0ee8d26da98b78c9
1e857/merged/etc/timezone\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying
to mount a directory onto a file (or vice-versa)? Check if the specified host path
exists and is the expected type.
注意:
docker run命令中的-v /etc/timezone變成了-v /etc/timezone/timezone
原因是centos7.6中/etc/timezone是一個文件夾,而不是一個文件
執(zhí)行如下命令
echo 'Asia/Shanghai' > /etc/timezone/timezone
然后執(zhí)行
docker run -d --name sys-app -v /etc/timezone/timezone:/etc/timezone -v /etc/localtime:/etc/localtime -p 8001:8001 --restart=always --net=host sys-app:latest
總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
docker?pull出現(xiàn)錯誤或速度慢具體解決辦法
docker pull的時候速度特別慢,急死我了,相信看到文章的你跟我是一個心情,下面這篇文章主要給大家介紹了關(guān)于docker?pull出現(xiàn)錯誤或速度慢的具體解決辦法,需要的朋友可以參考下2024-05-05
docker 創(chuàng)建RedHat8.5鏡像的命令
這篇文章主要介紹了docker 創(chuàng)建RedHat8.5鏡像的命令,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友參考下吧2024-03-03
docker容器通過ping直接運行獲取公網(wǎng)IP操作
這篇文章主要介紹了docker容器通過ping直接運行獲取公網(wǎng)IP操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-11-11
Docker遇到502 Bad Gateway問題的排查與解決方法
本文詳細(xì)描述了線上部署內(nèi)容服務(wù)時遇到的502 Bad Gateway問題,表面現(xiàn)象指向Nginx和Docker網(wǎng)絡(luò),但最終發(fā)現(xiàn)根因在于應(yīng)用代碼中使用不可重入鎖導(dǎo)致的死鎖,通過調(diào)整鎖的類型并進(jìn)行部署,問題得以解決,需要的朋友可以參考下2026-04-04
Docker 倉庫管理和Docker Dockerfile詳解
倉庫(Repository)是集中存放鏡像的地方,以下介紹一下 Docker Hub,當(dāng)然不止 docker hub,只是遠(yuǎn)程的服務(wù)商不一樣,操作都是一樣的,對Docker 倉庫管理相關(guān)知識感興趣的朋友一起看看吧2023-11-11

