Skip to main content

Posts

Showing posts with the label Container

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!

Install and Create LXC container on Ubuntu 18

Install LXC packages [root@lxcserver ~]# apt-get update [root@lxcserver ~]# apt-get install lxc lxc-templates Create LXC container [root@lxcserver ~]# lxc-create -n www1 -t ubuntu Start the LXC container [root@lxcserver ~]#   lxc-start -n www1 -d Reset password LXC container [root@lxcserver ~]# chroot /var/lib/lxc/ www1 /rootfs passwd Enter the console [root@lxcserver ~]#   lxc-console -n www1 -t 0 https://www.alibabacloud.com/blog/how-to-install-and-configure-lxc-container-on-ubuntu-16-04_594090 https://unixmen.com/setup-linux-containers-using-lxc-on-ubuntu-15-04/