Handling Docker at console
Version vom 8. Oktober 2019, 13:50 Uhr von Thomas.will (Diskussion | Beiträge) (→start a bash in a running container)
Docker run an image
- docker run -d -p 8480:80 -p 8443:443 -v /data/docker/apache_html:/var/www/html -v /data/docker/apache_etc:/etc/apache2 --name co-apache im-apache-03
| -d | demon mode |
| -p 8480:80 | host port 8480 to container port 80 |
| -p 8443:443 | host port 8443 to container port 443 |
| -v /data/docker/apache_html:/var/www/html | mount /data/docker/apache_html on host to var/www/html in the container |
| -v /data/docker/apache_etc:/etc/apache2 | mount /data/docker/apache_etc on host /etc/apache2 in the container |
| --name co-apache | name of the container |
| im-apache-03 | name of the image |
show the running container
- docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d12860279ef5 im-apache-03 "bash /start.sh" 11 minutes ago Up 11 minutes 0.0.0.0:8480->80/tcp, 0.0.0.0:8443->443/tcp co-apache
stop a container
- docker stop co-apache
start a container
- docker start co-apache
restart a container
- docker restart co-apache
start a bash in a running container
- docker exec -it co-apache bash
show logging from the container
- docker logs co-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message