Ir al contenido principal

Docker


Detener apache2 de ubuntu

sudo /etc/init.d/apache2 stop


Ahora para entrar debemos escribir el siguiente comando, puedes usar el nombre que le pusiste a tu docker o también puedes usar el ID
 
docker exec -i -t 665b4a1e17b6 /bin/bash # o en su caso poner el nombre
 
Once you’re satisfied that your bulletin board container works correctly, delete it: 
 
docker container rm --force bb 
 
 
Now, let's launch a container in detached mode as shown below:
$ docker run --name static-site -e AUTHOR="Your Name" -d -P dockersamples/static-site
e61d12292d69556eabe2a44c16cbd54486b2527e2ce4f95438e504afb7b02810
In the above command:
  • -d will create a container with the process detached from our terminal
  • -P will publish all the exposed container ports to random ports on the Docker host
  • -e is how you pass environment variables to the container
  • --name allows you to specify a container name
  • AUTHOR is the environment variable name and Your Name is the value that you can pass
Now you can see the ports by running the docker port command.
$ docker port static-site
443/tcp -> 0.0.0.0:32772
80/tcp -> 0.0.0.0:32773
 
If you are running Docker for Mac, Docker for Windows, or Docker on Linux, you can open http://localhost:[YOUR_PORT_FOR 80/tcp]. For our example this is http://localhost:32773.
If you are using Docker Machine on Mac or Windows, you can find the hostname on the command line using docker-machine as follows (assuming you are using the default machine).
$ docker-machine ip default
192.168.99.100
You can now open http://<YOUR_IPADDRESS>:[YOUR_PORT_FOR 80/tcp] to see your site live! For our example, this is: http://192.168.99.100:32773.
You can also run a second webserver at the same time, specifying a custom host port mapping to the container's webserver.
 
$ docker run --name static-site-2 -e AUTHOR="Your Name" -d -p 8888:80 dockersamples/static-site
 
 
https://devconnected.com/docker-exec-command-with-examples/
 
https://github.com/docker/labs/blob/master/beginner/chapters/webapps.md

Comentarios

Entradas populares de este blog

edX Certificado MITx

Servicio de validación de documentos:

Aprender rápidamente a desarrollar software

JavaScript for Beginners https://BeginnerJavaScript.com/friend... Javascript: The weird parts https://bit.ly/37lJ9in Advanced Javascript https://bit.ly/39vbIf8 Modern React with Redux https://bit.ly/2TBEDbI