-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update che.sh #1329
Merged
Merged
Update che.sh #1329
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -375,11 +375,45 @@ get_docker_ready () { | |
if [ "${WIN}" == "true" ] || [ "${MAC}" == "true" ]; then | ||
launch_docker_vm | ||
else | ||
# If Linux and docker ps fails, then this likely a file permissions issue. | ||
error_exit "Running 'docker' succeeded, but 'docker ps' failed. ` | ||
`This usually means that docker cannot reach its daemon. ` | ||
`On Mac and Linux, check the read / write permissions on '/var/run/docker.sock'. ` | ||
`Consider running 'sudo chmod 777 /var/run/docker.sock'." | ||
|
||
# CHE-1202: Improve error messages in case of docker ps failure | ||
# Verify that /var/run/docker.sock has owner and group read / write permissions | ||
PERMS=$(stat -c %A /var/run/docker.sock) | ||
OWNERREAD=$(cut -c2 <(echo $PERMS)) | ||
OWNERWRITE=$(cut -c3 <(echo $PERMS)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hard to read, use camelcase or underscore |
||
GROUPREAD=$(cut -c5 <(echo $PERMS)) | ||
GROUPWRITE=$(cut -c6 <(echo $PERMS)) | ||
|
||
if [[ "$OWNERREAD" != "r" || "$OWNERWRITE" != "w" || "$GROUPREAD" != "r" || "$GROUPWRITE" != "w" ]]; then | ||
error_exit "Running 'docker' succeeded, but 'docker ps' failed. \n` | ||
`The file /var/run/docker.sock does not have appropriate permissions. \n` | ||
`OWNER READ: ${OWNERREAD} \n` | ||
`OWNER WRITE: ${OWNERWRITE} \n` | ||
`GROUP READ: ${GROUPREAD} \n` | ||
`GROUP WRITE: ${GROUPWRITE} \n` | ||
`Run 'sudo chmod 660 /var/run/docker.sock' to give the right permissions." | ||
return | ||
fi | ||
|
||
# CHE-1202: Improve error messages in case of docker ps failure | ||
# Verify that docker client and server versions match | ||
DOCKERSERVERVERSION=$(docker version --format '{{.Server.Version}}') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hard to read, use camelcase or underscore |
||
DOCKERCLIENTVERSION=$(docker version --format '{{.Client.Version}}') | ||
|
||
if [[ "$DOCKERSERVERVERSION" != "$DOCKERCLIENTVERSION" ]]; then | ||
error_exit "Running 'docker' succeeded, but 'docker ps' failed. \n` | ||
`The docker client version does not match the docker server version. \n` | ||
`DOCKER SERVER: ${DOCKERSERVERVERSION} \n` | ||
`DOCKER CLIENT: ${DOCKERCLIENTVERSION} \n` | ||
`This can occur if you are running Che as a container itself. \n` | ||
`The Che container has an internal docker client that uses your host's docker server. \n` | ||
`Consider updating docker engine to have the versions match." | ||
return | ||
fi | ||
|
||
error_exit "Running 'docker' succeeded, but 'docker ps' failed. \n` | ||
`/var/run/docker.sock is ok and your docker client and server have matching versions. \n` | ||
`Run 'docker ps' and inspect the output for additional clues." | ||
return | ||
fi | ||
fi | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sudo chmod 660 /var/run/docker.sock
will help only when user has needed id or gidThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We perform the uid check elsewhere in the script. It is checked before getting to this step.