Task Detail

  • Basic commands for checking: Activity on Tue Apr 17 2018 14:42:01 GMT+0000 (UTC) 8. "docker exec -it gphan-mysql bash" - to get into the bash shell of the container. Activity on Fri Apr 13 2018 18:38:02 GMT+0000 (UTC) 6. "docker rmi <image-id>" - to remove an imagedo 7. "docker rm <conatiner-id>" - to remove a contaner Activity on Fri Apr 13 2018 13:50:27 GMT+0000 (UTC) 1. "docker image ls" - to list all the images that I have downloaded. 2. "docker container ls" - to list all the running containers. 3. "docker ps -a" - to list both running or not running containers. 4. "docker start gphan-mysql" - to start gphan-mysql container. 5. "docker stop gphan-mysql" - to stop gphan-mysql container.

    10/31/2024 13:55:44
  • Dockerfile Activity on Tue Apr 17 2018 15:26:45 GMT+0000 (UTC) Environment variables are supported by the following list of instructions in the Dockerfile: ADD COPY ENV EXPOSE FROM LABEL STOPSIGNAL USER VOLUME WORKDIR Activity on Tue Apr 17 2018 15:12:24 GMT+0000 (UTC) "-p 3307:3306" - 3307 is local machine port, and 3306 is the container port for mysql during forwarding port in Docker Activity on Fri Apr 13 2018 20:13:24 GMT+0000 (UTC) VOLUME: 1. A volume in a container is a folder which contains files for that OS of the container. 2. When we change the content inside of the index.php in our local src/ dir, the content can't be changed in the browser because the content was not changed in the container. 3. To change the content instantly, we will have to mount the volume in the container with our /src dir in our local machine. 4. "docker run -p 80:80 -v /Users/giangphan/Document/Development/php-docker/src/:/var/www/html/ hello-world" - command to mount /src in the local machine to /html in the docker container. Activity on Fri Apr 13 2018 20:05:32 GMT+0000 (UTC) Build and run the image: 1. "docker build -t hello-world ." - 'hello-world' is the name of the image, and the ' . ' indicates the current dir because the Dockerfile is in the current dir. 2. "docker image ls" - I would see "php" and "hello-world" image (the hello-world image was created base on the php image with extra configuration in Dockerfile). 3. "docker run -p 80:80 hello-world" - '-p 80:80' to map the port 80 from the container to port 80 of the local machine. 4. Now, in a browser, localhost would give me hello world message from the index.php Activity on Fri Apr 13 2018 19:53:34 GMT+0000 (UTC) Explaining Dockerfile for php docker: FROM php:7.0-apache COPY src/ /var/www/html/ EXPOSE 80 1. "FROM php:7.0-apache " - "FROM" which php package to get from the list of https://hub.docker.com/_/php/; "php" is what we want to name the image repository, "7.0-apache" is the 2. "COPY src/ /var/www/html/" - this command tell docker to copy everything in my local src/ folder to html/ folder inside of the docker container. (html/ folder is where apache read index.php and other html files). 3. "EXPOSE 80" - to expose port 80 of the container to the outside world. Activity on Fri Apr 13 2018 19:29:11 GMT+0000 (UTC) https://hub.docker.com/_/php/ https://www.youtube.com/watch?v=YFl2mCHdv24 https://docs.docker.com/engine/reference/builder/ 1. Dockerfile is configuration file to build a docker image. 2. Dockerfile contains all the commands a user could call on the command to assemble an image.

    10/31/2024 13:54:40
  • Dockerfile vs Dockercompse Activity on Tue Apr 17 2018 17:25:31 GMT+0000 (UTC) 1. When a .yml get deploy by Docker, Docker compose them in small parts and run them as small Dockerfiles. Activity on Tue Apr 17 2018 17:21:55 GMT+0000 (UTC) 1. Dockerfile is a Docker standard file that only work in Docker environment and has not extension file name. 2. Dockerfile contains configuration of a single image, and that image get built from the Dockerfile. 3. Docker Compose is a process to compose one or more images in a .yml file to build a combination application. 4. Docker Compose process starts from deploy all the images in .yml file with their configuration into different containers but connecting somehow by Docker.

    10/31/2024 13:53:20
  • Activity on Wed Apr 18 2018 13:07:31 GMT+0000 (UTC) https://docs.docker.com/compose/compose-file/ use the link below for more yml service and references.

    10/31/2024 13:52:04
  • Docker-compose.yml Activity on Wed Apr 18 2018 13:06:10 GMT+0000 (UTC) version: '3.1' services: db: image: mysql environment: MYSQL_ROOT_PASSWORD: dafdsfhdaskf adminer: image: adminer ports: - 8080:8080 sam: image: php:7.0-apache ports: - 5000:80 depends_on: - db # The above code is a .yml example file that I created for SAM application # "version:'3.1'" - latest version of YAML/YML file version. # "services:" - we always start our with services, and fill out each application/container image and their setting. # "db:" - I can name this however I want. # "image:mysql" - this mysql have to be match with mysql docker tag https://hub.docker.com/_/mysql/. When I do this without verify the version, it will get the latest for me. # "environment:" - this is part of db yml configuration, I will have to check within https://hub.docker.com/_/mysql/ # Same go for the other services setting.

    10/31/2024 13:51:45