Browse Source

docker 3

master
test2 5 years ago
parent
commit
1b36e49270
  1. 71
      DockerSwarm/Intro-Cloud.adoc

71
DockerSwarm/Intro-Cloud.adoc

@ -1,4 +1,4 @@
= Εισαγωγή στο Cloud !
= Cloud !
Apostolos rootApostolos@swarmlab.io
// Metadata:
:description: IoT Εισαγωγή στο Cloud
@ -197,7 +197,7 @@ This command is used to display all the images currently installed on the system
Docker Hub is a registry service on the cloud that allows you to download Docker images that are built by other communities. You can also upload your own Docker built images to Docker hub.
To run apache, you need to run the following command
To run apache, you need to run the following command:
.run docker image from Docker Hub
[source,sh]
@ -300,7 +300,74 @@ Options
ContainerID − This is the Container ID which needs to be removed.
----
==== Container Logging
Logging is also available at the container level.
.docker log
[source,sh]
----
Docker logs containerID
Parameters
containerID − This is the ID of the container for which you need to see the logs.
----
=== Volumes
Volumes are the preferred mechanism for persisting data generated by and used by Docker containers.
.docker volumes
[source,sh]
----
docker run -d --name mycontainer -v /var/www/html:/var/html nginx:latest
----
=== repositories
You might have the need to have your own private repositories. You may not want to host the repositories on Docker Hub. For this, there is a repository container itself from Docker. Let’s see how we can download and use the container for registry.
=== Create
.docker registry
[source,sh]
----
docker run –d –p 5000:5000 –-name registry registry:2
The following points need to be noted about the above command:
Registry is the container managed by Docker which can be used to host private repositories.
The port number exposed by the container is 5000. Hence with the –p command, we are mapping the same port number to the 5000 port number on our localhost.
We are just tagging the registry container as “2”, to differentiate it on the Docker host.
The –d option is used to run the container in detached mode. This is so that the container can run in the background
----
=== Push
use the Docker push command to push the image to our private repository.
.docker registry
[source,sh]
----
docker push localhost:5000/myimage
----
=== Pull
use the following Docker pull command to pull image from our private repository.
.docker registry
[source,sh]
----
docker pull localhost:5000/myimage
----

Loading…
Cancel
Save