docker.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # Copyright 2014 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. DOCKER_OPTS=${1:-""}
  16. DOCKER_CONFIG=/opt/kubernetes/cfg/docker
  17. cat <<EOF >$DOCKER_CONFIG
  18. DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock -s devicemapper --selinux-enabled=false ${DOCKER_OPTS}"
  19. EOF
  20. cat <<EOF >/usr/lib/systemd/system/docker.service
  21. [Unit]
  22. Description=Docker Application Container Engine
  23. Documentation=http://docs.docker.com
  24. After=network.target flannel.service
  25. Requires=flannel.service
  26. [Service]
  27. Type=notify
  28. EnvironmentFile=-/run/flannel/docker
  29. EnvironmentFile=-/opt/kubernetes/cfg/docker
  30. WorkingDirectory=/opt/kubernetes/bin
  31. ExecStart=/opt/kubernetes/bin/docker daemon \$DOCKER_OPT_BIP \$DOCKER_OPT_MTU \$DOCKER_OPTS
  32. LimitNOFILE=1048576
  33. LimitNPROC=1048576
  34. [Install]
  35. WantedBy=multi-user.target
  36. EOF
  37. systemctl daemon-reload
  38. systemctl enable docker
  39. systemctl start docker