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
-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 nameAUTHOR
is the environment variable name andYour Name
is the value that you can pass
docker port
command.$ docker port static-site
443/tcp -> 0.0.0.0:32772
80/tcp -> 0.0.0.0:32773
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
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
Publicar un comentario