Skip to main content

Posts

Showing posts with the label Docker

Write docker file and create a container with os debian and mysql installed

 Below is a simple example of a Dockerfile to create a Docker container with Debian OS and MySQL installed. This example uses the official MySQL Docker image available on Docker Hub. # Use the official Debian base image FROM debian:latest # Set environment variables for MySQL ENV MYSQL_ROOT_PASSWORD=root_password ENV MYSQL_DATABASE=mydatabase ENV MYSQL_USER=myuser ENV MYSQL_PASSWORD=mypassword # Install MySQL server RUN apt-get update && apt-get install -y \     mysql-server \     && rm -rf /var/lib/apt/lists/* # Configure MySQL to allow remote connections RUN sed -i 's/127.0.0.1/0.0.0.0/' /etc/mysql/mysql.conf.d/mysqld.cnf # Expose the MySQL port EXPOSE 3306 # Start MySQL server on container startup CMD ["mysqld"] # To build the Docker image, run: # docker build -t debian-mysql . # To run the container, execute: # docker run -d -p 3306:3306 --name mysql-container debian-mysql Please note that setting a root password for MySQL in this manner is not rec

Simple create a container with podman

Basically podman will use qemu as emulator with fedora core os to host the container. Run docker and mount some folder on the laptop host. Steps: 1. Stop container machine podman machine stop or podman machine stop your-machine-name 2. Create and start a machine named "my-tools" without  any bindings. podman machine init --now my-tools 3. Set the connection to the "tools" machine as the default connection. podman system connection default my-tools 4. Example run a container to my-tools machine and than try to lists the content of the Mac /Users/bagussa/home directory. podman run --rm -v /Users/bagussa/home:/home debian:latest ls -la /Users Thanks!

How to install Docker on EC2 AWS

 1. Install docker sudo yum update sudo yum install -y docker sudo usermod -a -G docker ec2-user sudo service docker start sudo chkconfig docker on 2. Install docker compose sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m` | sudo tee /usr/local/bin/docker-compose > /dev/null sudo chmod +x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose 3. Check that docker compose  docker-compose --version