ഉബുണ്ടുവിൽ ഡോക്കർ എങ്ങനെ ഇൻസ്റ്റാൾ ചെയ്യാം, ഡോക്കർ കണ്ടെയ്uനറുകൾ പ്രവർത്തിപ്പിക്കാം
ഡോക്കർ ഒരു ഓപ്പൺ സോഴ്uസും ജനപ്രിയ ഓപ്പറേറ്റിംഗ് സിസ്റ്റം ലെവൽ വെർച്വലൈസേഷൻ (സാധാരണയായി \കണ്ടെയ്uനറൈസേഷൻ എന്ന് അറിയപ്പെടുന്നു) സാങ്കേതികവിദ്യയാണ്, അത് പ്രാഥമികമായി ലിനക്സിലും വിൻഡോസിലും പ്രവർത്തിക്കുന്നു. കണ്ടെയ്നറുകൾ ഉപയോഗിച്ച് ആപ്ലിക്കേഷനുകൾ സൃഷ്ടിക്കുന്നതും വിന്യസിക്കുന്നതും പ്രവർത്തിപ്പിക്കുന്നതും ഡോക്കർ എളുപ്പമാക്കുന്നു.
കണ്ടെയ്uനറുകൾ ഉപയോഗിച്ച്, ഡെവലപ്പർമാർക്ക് (സിസ്റ്റം അഡ്മിനിസ്ട്രേറ്റർമാർക്ക്) ആപ്ലിക്കേഷൻ പ്രവർത്തിപ്പിക്കുന്നതിന് ആവശ്യമായ എല്ലാം അടങ്ങിയ ഒരു ആപ്ലിക്കേഷൻ പാക്കേജ് ചെയ്യാൻ കഴിയും - കോഡ്, ഒരു റൺ-ടൈം, ലൈബ്രറികൾ, എൻവയോൺമെന്റ് വേരിയബിളുകൾ, കോൺഫിഗറേഷൻ ഫയലുകൾ, കൂടാതെ എല്ലാം ഒരു പാക്കേജായി ഷിപ്പ് ചെയ്യുക. അതെ, അത് വളരെ മികച്ചതാണ്!
ഈ ലേഖനത്തിൽ, ഡോക്കർ സിഇ (കമ്മ്യൂണിറ്റി എഡിഷൻ) എങ്ങനെ ഇൻസ്റ്റാൾ ചെയ്യാമെന്നും ഉബുണ്ടു വിതരണത്തിൽ ഡോക്കർ കണ്ടെയ്uനറുകൾ സൃഷ്uടിച്ച് പ്രവർത്തിപ്പിക്കാമെന്നും ഞങ്ങൾ നിങ്ങളെ കാണിക്കും.
ഉബുണ്ടുവിൽ ഡോക്കർ സിഇ (കമ്മ്യൂണിറ്റി എഡിഷൻ) ഇൻസ്റ്റാൾ ചെയ്യുന്നു
1. ഡോക്കർ സിഇ ഇൻസ്റ്റാൾ ചെയ്യാൻ, ആദ്യം, ഡോക്കറിന്റെ പഴയ പതിപ്പുകൾ നീക്കം ചെയ്യേണ്ടതുണ്ട് docker
, docker.io
, അല്ലെങ്കിൽ docker-engine
താഴെ പറയുന്ന കമാൻഡ് ഉപയോഗിച്ച് സിസ്റ്റത്തിൽ നിന്ന്.
$ sudo apt-get remove docker docker-engine docker.io containerd runc
2. അടുത്തതായി, ഇനിപ്പറയുന്ന കമാൻഡുകൾ ഉപയോഗിച്ച് റിപ്പോസിറ്ററിയിൽ നിന്ന് ഡോക്കർ ഇൻസ്റ്റാൾ ചെയ്യാനും അപ്ഡേറ്റ് ചെയ്യാനും നിങ്ങൾ ഡോക്കർ ശേഖരണം സജ്ജീകരിക്കേണ്ടതുണ്ട്.
$ sudo apt-get update $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
3. ആപ്റ്റ് പാക്കേജ് ഇൻഡക്സ് അപ്ഡേറ്റ് ചെയ്യുക, താഴെ പറയുന്ന കമാൻഡുകൾ ഉപയോഗിച്ച് ഡോക്കർ സിഇയുടെ ഏറ്റവും പുതിയ പതിപ്പ് ഇൻസ്റ്റാൾ ചെയ്യുക.
$ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: aufs-tools cgroupfs-mount pigz The following NEW packages will be installed: aufs-tools cgroupfs-mount containerd.io docker-ce docker-ce-cli pigz 0 upgraded, 6 newly installed, 0 to remove and 167 not upgraded. Need to get 50.7 MB of archives. After this operation, 243 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 pigz amd64 2.4-1 [57.4 kB] Get:2 https://download.docker.com/linux/ubuntu bionic/stable amd64 containerd.io amd64 1.2.4-1 [19.9 MB] Get:3 http://archive.ubuntu.com/ubuntu bionic/universe amd64 aufs-tools amd64 1:4.9+20170918-1ubuntu1 [104 kB] Get:4 http://archive.ubuntu.com/ubuntu bionic/universe amd64 cgroupfs-mount all 1.4 [6,320 B] Get:5 https://download.docker.com/linux/ubuntu bionic/stable amd64 docker-ce-cli amd64 5:18.09.3~3-0~ubuntu-bionic [13.1 MB] Get:6 https://download.docker.com/linux/ubuntu bionic/stable amd64 docker-ce amd64 5:18.09.3~3-0~ubuntu-bionic [17.4 MB] Fetched 50.7 MB in 7s (7,779 kB/s) ...
4. ഡോക്കർ സിഇ പാക്കേജ് വിജയകരമായി ഇൻസ്റ്റാൾ ചെയ്ത ശേഷം, സിസ്റ്റം ബൂട്ടിൽ ആരംഭിക്കുന്നതിന് സേവനം യാന്ത്രികമായി ആരംഭിക്കുകയും യാന്ത്രികമായി പ്രവർത്തനക്ഷമമാക്കുകയും വേണം, ഇനിപ്പറയുന്ന കമാൻഡ് ഉപയോഗിച്ച് നിങ്ങൾക്ക് അതിന്റെ നില പരിശോധിക്കാം.
$ sudo systemctl status docker
● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2019-03-06 08:06:42 UTC; 2min 18s ago Docs: https://docs.docker.com Main PID: 5274 (dockerd) Tasks: 8 CGroup: /system.slice/docker.service └─5274 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock Mar 06 08:06:41 tecmint dockerd[5274]: time="2019-03-06T08:06:41.562587408Z" level=warning msg="Your kernel does not support cgroup rt runtime" Mar 06 08:06:41 tecmint dockerd[5274]: time="2019-03-06T08:06:41.562767803Z" level=warning msg="Your kernel does not support cgroup blkio weight" Mar 06 08:06:41 tecmint dockerd[5274]: time="2019-03-06T08:06:41.562966844Z" level=warning msg="Your kernel does not support cgroup blkio weight_device" Mar 06 08:06:41 tecmint dockerd[5274]: time="2019-03-06T08:06:41.565298457Z" level=info msg="Loading containers: start." Mar 06 08:06:41 tecmint dockerd[5274]: time="2019-03-06T08:06:41.950942467Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a prefer Mar 06 08:06:42 tecmint dockerd[5274]: time="2019-03-06T08:06:42.036964493Z" level=info msg="Loading containers: done." Mar 06 08:06:42 tecmint dockerd[5274]: time="2019-03-06T08:06:42.156279378Z" level=info msg="Docker daemon" commit=774a1f4 graphdriver(s)=overlay2 version=18.09.3 Mar 06 08:06:42 tecmint dockerd[5274]: time="2019-03-06T08:06:42.157145045Z" level=info msg="Daemon has completed initialization" Mar 06 08:06:42 tecmint systemd[1]: Started Docker Application Container Engine. Mar 06 08:06:42 tecmint dockerd[5274]: time="2019-03-06T08:06:42.224229999Z" level=info msg="API listen on /var/run/docker.sock"
5. അവസാനമായി, hello-world
ഇമേജ് പ്രവർത്തിപ്പിച്ച് ഡോക്കർ സിഇ ശരിയായി ഇൻസ്റ്റാൾ ചെയ്തിട്ടുണ്ടോയെന്ന് പരിശോധിക്കുക.
$ sudo docker run hello-world
Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
ഉബുണ്ടുവിൽ അടിസ്ഥാന ഡോക്കർ കമാൻഡുകൾ പഠിക്കുക
6. ഡോക്കറിനെക്കുറിച്ചുള്ള വിവരങ്ങൾ ലഭിക്കുന്നതിന്, ഇനിപ്പറയുന്ന കമാൻഡ് പ്രവർത്തിപ്പിക്കുക.
$ sudo docker info Kernel Version: 5.0.0-050000-generic Operating System: Ubuntu 18.04.1 LTS OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 1.452GiB Name: tecmint ID: FWSB:IRIF:DYL7:PRB5:Y66E:37MY:ISPO:HZVY:6YJO:2IYL:TO6Y:GNB7 Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false Product License: Community Engine
7. ഡോക്കർ പതിപ്പിനെക്കുറിച്ചുള്ള വിവരങ്ങൾ ലഭിക്കുന്നതിന്, ഇനിപ്പറയുന്ന കമാൻഡ് പ്രവർത്തിപ്പിക്കുക.
$ sudo docker version Client: Version: 18.09.3 API version: 1.39 Go version: go1.10.8 Git commit: 774a1f4 Built: Thu Feb 28 06:53:11 2019 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 18.09.3 API version: 1.39 (minimum version 1.12) Go version: go1.10.8 Git commit: 774a1f4 Built: Thu Feb 28 05:59:55 2019 OS/Arch: linux/amd64 Experimental: false
8. ലഭ്യമായ എല്ലാ ഡോക്കർ കമാൻഡുകളുടെയും ഒരു ലിസ്റ്റ് ലഭിക്കുന്നതിന് നിങ്ങളുടെ ടെർമിനലിൽ docker
പ്രവർത്തിപ്പിക്കുക.
$ docker Usage: docker [OPTIONS] COMMAND A self-sufficient runtime for containers Options: --config string Location of client config files (default "/home/tecmint/.docker") -D, --debug Enable debug mode -H, --host list Daemon socket(s) to connect to -l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info") --tls Use TLS; implied by --tlsverify --tlscacert string Trust certs signed only by this CA (default "/home/tecmint/.docker/ca.pem") --tlscert string Path to TLS certificate file (default "/home/tecmint/.docker/cert.pem") --tlskey string Path to TLS key file (default "/home/tecmint/.docker/key.pem") --tlsverify Use TLS and verify the remote -v, --version Print version information and quit Management Commands: builder Manage builds config Manage Docker configs container Manage containers engine Manage the docker engine image Manage images network Manage networks node Manage Swarm nodes plugin Manage plugins secret Manage Docker secrets service Manage services stack Manage Docker stacks swarm Manage Swarm system Manage Docker trust Manage trust on Docker images volume Manage volumes ....
ഉബുണ്ടുവിൽ ഒരു ഡോക്കർ ഇമേജ് ഡൗൺലോഡ് ചെയ്യുക
9. ഒരു ഡോക്കർ കണ്ടെയ്uനർ പ്രവർത്തിപ്പിക്കുന്നതിന്, ആദ്യം നിങ്ങൾ ഡോക്കർ ഹബ്ബിൽ നിന്ന് ഒരു ചിത്രം ഡൗൺലോഡ് ചെയ്യേണ്ടതുണ്ട് - അതിന്റെ ശേഖരണങ്ങളിൽ നിന്ന് സൗജന്യ ചിത്രങ്ങൾ നൽകുന്നു.
ഉദാഹരണത്തിന്, CentOS 7
എന്ന ഡോക്കർ ഇമേജ് ഡൗൺലോഡ് ചെയ്യുന്നതിന്, ഇനിപ്പറയുന്ന കമാൻഡ് നൽകുക.
$ sudo docker search centos NAME DESCRIPTION STARS OFFICIAL AUTOMATED centos The official build of CentOS. 5227 [OK] ansible/centos7-ansible Ansible on Centos7 120 [OK] jdeathe/centos-ssh CentOS-6 6.10 x86_64 / CentOS-7 7.5.1804 x86… 107 [OK] consol/centos-xfce-vnc Centos container with "headless" VNC session… 81 [OK] imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 50 [OK] centos/mysql-57-centos7 MySQL 5.7 SQL database server 47 tutum/centos Simple CentOS docker image with SSH access 43 gluster/gluster-centos Official GlusterFS Image [ CentOS-7 + Glust… 40 [OK] openshift/base-centos7 A Centos7 derived base image for Source-To-I… 39 centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relational … 37 centos/python-35-centos7 Platform for building and running Python 3.5… 33 kinogmt/centos-ssh CentOS with SSH 26 [OK] openshift/jenkins-2-centos7 A Centos7 based Jenkins v2.x image for use w… 20 centos/php-56-centos7 Platform for building and running PHP 5.6 ap… 19 pivotaldata/centos-gpdb-dev CentOS image for GPDB development. Tag names… 10 openshift/wildfly-101-centos7 A Centos7 based WildFly v10.1 image for use … 6 openshift/jenkins-1-centos7 DEPRECATED: A Centos7 based Jenkins v1.x ima… 4 darksheer/centos Base Centos Image -- Updated hourly 3 [OK] pivotaldata/centos Base centos, freshened up a little with a Do… 2 pivotaldata/centos-mingw Using the mingw toolchain to cross-compile t… 2 pivotaldata/centos-gcc-toolchain CentOS with a toolchain, but unaffiliated wi… 1 openshift/wildfly-81-centos7 A Centos7 based WildFly v8.1 image for use w… 1 blacklabelops/centos CentOS Base Image! Built and Updates Daily! 1 [OK] smartentry/centos centos with smartentry 0 [OK] jameseckersall/sonarr-centos Sonarr on CentOS 7 0 [OK]
10. നിങ്ങളുടെ ആവശ്യകതകളെ അടിസ്ഥാനമാക്കി ഏത് ചിത്രമാണ് റൺ ചെയ്യേണ്ടതെന്ന് നിങ്ങൾ നിർണ്ണയിച്ചതിന് ശേഷം, ചുവടെയുള്ള കമാൻഡ് പ്രവർത്തിപ്പിച്ച് പ്രാദേശികമായി അത് ഡൗൺലോഡ് ചെയ്യുക (ഈ സാഹചര്യത്തിൽ ഒരു CentOS ഇമേജ് ഡൗൺലോഡ് ചെയ്യുകയും ഉപയോഗിക്കുകയും ചെയ്യുന്നു).
$ docker pull centos Using default tag: latest latest: Pulling from library/centos a02a4930cb5d: Pull complete Digest: sha256:184e5f35598e333bfa7de10d8fb1cebb5ee4df5bc0f970bf2b1e7c7345136426 Status: Downloaded newer image for centos:latest
11. നിങ്ങളുടെ ഹോസ്റ്റിൽ ലഭ്യമായ എല്ലാ ഡോക്കർ ഇമേജുകളും ലിസ്റ്റുചെയ്യുന്നതിന് ഇനിപ്പറയുന്ന കമാൻഡ് പ്രവർത്തിപ്പിക്കുക.
$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest fce289e99eb9 2 months ago 1.84kB centos latest 1e1148e4cc2c 3 months ago 202MB
12. നിങ്ങൾക്ക് ഇനി ഒരു ഡോക്കർ ഇമേജ് ആവശ്യമില്ലെങ്കിൽ താഴെ പറയുന്ന കമാൻഡ് ഉപയോഗിച്ച് നിങ്ങൾക്ക് അത് നീക്കം ചെയ്യാം.
$ sudo docker rmi centos Untagged: centos:latest Untagged: [email :184e5f35598e333bfa7de10d8fb1cebb5ee4df5bc0f970bf2b1e7c7345136426 Deleted: sha256:1e1148e4cc2c148c6890a18e3b2d2dde41a6745ceb4e5fe94a923d811bf82ddb Deleted: sha256:071d8bd765171080d01682844524be57ac9883e53079b6ac66707e192ea25956
ഉബുണ്ടുവിൽ ഒരു ഡോക്കർ കണ്ടെയ്uനർ പ്രവർത്തിപ്പിക്കുക
13. ഒരു ഡോക്കർ കണ്ടെയ്uനർ സൃഷ്uടിക്കുന്നതിനും പ്രവർത്തിപ്പിക്കുന്നതിനും, ആദ്യം നിങ്ങൾ ഡൗൺലോഡ് ചെയ്uത CentOS
ഇമേജിലേക്ക് ഒരു കമാൻഡ് പ്രവർത്തിപ്പിക്കേണ്ടതുണ്ട്, അതിനാൽ cat കമാൻഡ് ഉപയോഗിച്ച് കണ്ടെയ്uനറിനുള്ളിലെ വിതരണ പതിപ്പ് ഫയൽ പരിശോധിക്കുന്നതാണ് അടിസ്ഥാന കമാൻഡ്. , കാണിച്ചിരിക്കുന്നതുപോലെ.
$ docker run centos cat /etc/issue
14. കണ്ടെയ്uനറുകൾ വീണ്ടും പ്രവർത്തിപ്പിക്കുന്നതിന്, ഇനിപ്പറയുന്ന കമാൻഡ് പ്രവർത്തിപ്പിച്ച് ആദ്യം നിങ്ങൾ കണ്ടെയ്uനർ ഐഡിയോ പേരോ നേടേണ്ടതുണ്ട്, അത് പ്രവർത്തിക്കുന്നതും നിർത്തിയതുമായ കണ്ടെയ്uനറുകളുടെ ഒരു ലിസ്റ്റ് പ്രദർശിപ്പിക്കും:
$ sudo docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0ddfa81c5779 centos "cat /etc/issue" About a minute ago Exited (0) About a minute ago elastic_shirley
15. കണ്ടെയ്uനർ ഐഡി അല്ലെങ്കിൽ പേര് ലഭിച്ചുകഴിഞ്ഞാൽ, ഇനിപ്പറയുന്ന കമാൻഡ് ഉപയോഗിച്ച് നിങ്ങൾക്ക് കണ്ടെയ്uനർ ആരംഭിക്കാം:
$ sudo docker start 0ddfa81c5779 OR $ sudo docker start elastic_shirley
ഇവിടെ, 0ddfa81c5779
എന്ന സ്uട്രിംഗ് കണ്ടെയ്uനർ ഐഡിയെയും elastic_shirley
കണ്ടെയ്uനറിന്റെ പേരിനെയും പ്രതിനിധീകരിക്കുന്നു.
16. റൺ ചെയ്യുന്ന കണ്ടെയ്uനർ നിർത്താൻ കണ്ടെയ്uനർ ഐഡി അല്ലെങ്കിൽ പേര് വ്യക്തമാക്കി docker stop
കമാൻഡ് പ്രവർത്തിപ്പിക്കുക.
$ sudo docker stop 0ddfa81c5779 OR $ sudo docker stop elastic_shirley
17. കണ്ടെയ്uനർ ഐഡി ഓർത്തിരിക്കേണ്ടതില്ലാത്ത ഒരു മികച്ച മാർഗം, കാണിച്ചിരിക്കുന്നതുപോലെ --name
ഓപ്ഷൻ ഉപയോഗിച്ച് നിങ്ങൾ സൃഷ്uടിക്കുന്ന ഓരോ കണ്ടെയ്uനറിനും തനതായ പേര് നിർവചിക്കുക എന്നതാണ്.
$ docker run --name myname centos cat /etc/issue
18. ഒരു കണ്ടെയ്uനറിലേക്ക് Linux കമാൻഡുകൾ കണക്റ്റ് ചെയ്യുന്നതിനും പ്രവർത്തിപ്പിക്കുന്നതിനും ഇനിപ്പറയുന്ന കമാൻഡ് നൽകുക.
$ docker run -it centos bash uname -a Linux 6213ec547863 5.0.0-050000-generic #201903032031 SMP Mon Mar 4 01:33:18 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core)
19. പ്രവർത്തിക്കുന്ന കണ്ടെയ്uനർ സെഷനിൽ നിന്ന് പുറത്തുകടക്കാനും ഹോസ്റ്റിലേക്ക് തിരികെ പോകാനും കാണിച്ചിരിക്കുന്നതുപോലെ നിങ്ങൾ exit
കമാൻഡ് ടൈപ്പ് ചെയ്യണം.
$ exit
അടിസ്ഥാന കണ്ടെയ്നർ കൃത്രിമത്വത്തിന് അത്രമാത്രം. ഈ ലേഖനത്തെക്കുറിച്ച് നിങ്ങൾക്ക് എന്തെങ്കിലും ചോദ്യങ്ങളോ അഭിപ്രായങ്ങളോ ഉണ്ടെങ്കിൽ, ഞങ്ങളെ ബന്ധപ്പെടുന്നതിന് ചുവടെയുള്ള ഫീഡ്uബാക്ക് ഫോം ഉപയോഗിക്കുക.