-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jeessy2
committed
Dec 25, 2020
1 parent
a75ffd9
commit 37ddbcf
Showing
2 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package util | ||
|
||
import "os" | ||
|
||
// DockerEnvFile Docker容器中包含的文件 | ||
const DockerEnvFile string = "/.dockerenv" | ||
|
||
// IsRunInDocker 是否在docker中运行 | ||
func IsRunInDocker() bool { | ||
_, err := os.Stat(DockerEnvFile) | ||
if err != nil { | ||
return false | ||
} | ||
return true | ||
} |