Skip to content
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

Use the mirror in China for Azure China environment #27005

Merged
merged 1 commit into from
Oct 11, 2016

Conversation

lizzha
Copy link

@lizzha lizzha commented Sep 29, 2016

We've set up a mirror of docker installation packages in Azure China, which syncs with docker repo every day, to mitigate the pain due to connection issues from China to docker official repo.
A new parameter is added in this change. If '-e AzureChinaCloud' is specified, the script will use the packages from the mirror in Azure China.

@GordonTheTurtle GordonTheTurtle added status/0-triage dco/no Automatically set by a bot when one of the commits lacks proper signature labels Sep 29, 2016
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 29, 2016
@thaJeztah
Copy link
Member

Thank you for your contribution! I think this may need some extra eyes, as I don't know if there's objections against referring to a third-party mirror

ping @kencochrane @tianon @tibor

@lizzha
Copy link
Author

lizzha commented Sep 29, 2016

@thaJeztah Thank you for the comment, we had some previous communication and agreement with Docker about this mirror.
@friism as FYI

@friism
Copy link
Contributor

friism commented Sep 29, 2016

Thanks for the PR! Confirming that this was discussed previously and agree that there were no major objections raised. This should still go through the regular review process.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the idea sounds sane (and thanks to GPG, should be generally as safe as install.sh ever is), just some minor style comments. 👍

if [ ! -z "$environment" ] && [ $environment = "AzureChinaCloud" ]; then
apt_url="https://mirror.azure.cn/docker-engine/apt"
yum_url="https://mirror.azure.cn/docker-engine/yum"
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd make sense to move this whole block up closer to the initial setting of these variables (so we keep our constants all in one place, especially including the new args to the script this introduces).

esac
done

if [ ! -z "$environment" ] && [ $environment = "AzureChinaCloud" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$environment should be quoted here, and it might actually make sense to convert this to a case for simplicity, ie:

case "$environment" in
    AzureChinaCloud)
        ....
        ;;
esac

while getopts "e:" opt; do
case $opt in
e)
environment=$OPTARG
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable ought to be initialized before this loop starts to ensure we don't get side effects from the enclosing shell, ie environment= on a line by itself right before the while starts.

@lizzha
Copy link
Author

lizzha commented Sep 30, 2016

Thank you for reviewing. Comments addressed.

environment=''
while getopts "e:" opt; do
case $opt in
e)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the option should have a more descriptive name (for example, -mirror?) @tianon wdyt?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thaJeztah can we use --mirror | -m ?

@tianon
Copy link
Member

tianon commented Oct 8, 2016 via email

@lizzha
Copy link
Author

lizzha commented Oct 11, 2016

Please let me know if you have more comments, thanks.

@thaJeztah
Copy link
Member

@lizzha can you squash Your commits so that there's only a single commit in this PR?

Signed-off-by: Liz Zhang <[email protected]>

Use the mirror in China for Azure China environment

Signed-off-by: Liz Zhang <[email protected]>

Update option name to --mirror

Signed-off-by: Liz Zhang <[email protected]>

Update indent and change variable name

Signed-off-by: Liz Zhang <[email protected]>
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Oct 11, 2016
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Oct 11, 2016
@lizzha
Copy link
Author

lizzha commented Oct 11, 2016

Done :)

@thaJeztah
Copy link
Member

ping @tianon for final review / merge

@tianon
Copy link
Member

tianon commented Oct 11, 2016

LGTM

@tianon tianon merged commit 8d6e9f0 into moby:master Oct 11, 2016
@lizzha
Copy link
Author

lizzha commented Oct 12, 2016

Thank you! When will https://get.docker.com/ get refreshed with this change?

@thaJeztah
Copy link
Member

@lizzha usually that script is updated with each release, and this just missed the 1.12.2 release; in exceptional cases we can update the script manually, but I'll have to ask if that applies here.

@thaJeztah thaJeztah added this to the 1.13.0 milestone Nov 9, 2016
@twang2218
Copy link

I have 2 questions:

May I ask how to use this --mirror argument with https://get.docker.com if it's been updated? Is there any documentation about it?

Currently I use curl -sSL https://get.docker.com/ | sh to install the docker, I'm not quite sure how to add --mirror to it.

This PR is using the hardcoded Azure mirror, is there a way to use other mirror?

To avoid GFW issue, there are several mirrors in China provided by various cloud providers, such as:

Is there a way to use those mirror? or Azure mirror is an official Docker mirror in China?

@lizzha
Copy link
Author

lizzha commented Nov 16, 2016

@twang2218 once https://get.docker.com gets updated, you could use "curl -sSL https://get.docker.com/ | sh -s -- --mirror AzureChinaCloud" to install docker in China
The mirror is hosted in AzureChinaCloud and maintained by Microsoft. We have the agreement that the mirrored docker installation packages and script are exactly the same as the official ones.

@ushuz
Copy link

ushuz commented Nov 26, 2016

I recall there's a co-op between Docker Inc. and Alibaba Cloud to bring Docker Hub on Alibaba Cloud for China Mainland, how's that going?

@thaJeztah
Copy link
Member

@ushuz this repo is for the open source "docker" project, I don't have additional information about that

@twang2218
Copy link

Created a PR #28858 to add Alibaba Cloud Docker apt/yum mirror support to 'hack/install.sh'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants