1. Here we use 5.7.29 Docker image as an example. $ docker load -i mysql-enterprise-server-5.7.29.tar 2. You can bind OS mounts to Docker directory, assume you want to keep the audit logs under /bak/logs directory on the host. $ docker run –name=mysql1 \ –mount type=bind,src=/bak/my.cnf,dst=/etc/my.cnf \ –mount type=bind,src=/bak/data,dst=/var/lib/mysql \ –mount type=bind,src=/bak/logs,dst=/var/lib/logs \ -d mysql/enterprise-server:5.7 3. […]
Docker
How to Create a MySQL Docker Container for Testing
Docker is a container runtime environment that allows programs to operate in a jailed environment without any required external dependencies. Containers are similar in some concepts to virtual machines, however, they do not use a hypervisor and run in a single kernel instance, often sharing the instance with other containers. One of the prime features […]
Unable to run NGINX Docker due to “13: Permission denied”
The Problem The NGINX docker container was started using the below command: # docker run –detach –name nginx_server nginx 4ffbcd5ee796b8cce3f2c6ed4cce8927d2b13a040af07b36f7a866b2157290e8 But user failed to get connection to the NGINX server. Upon troubleshooting user found below error logs: # tail -f /var/log/audit/audit.log type=AVC msg=audit(1565283160.116:316): avc: denied { write } for pid=2387 comm=”nginx” name=”nginx” dev=”dm-0″ ino=140648937 scontext=system_u:system_r:container_t:s0:c345,c550 […]
How to Configure Network Namespaces in Docker Containers
This post tells how Docker uses network namespace to isolate resources. The following figure is the lab setup to help you understand the steps visually: 1. Create two network namespaces: ns1 and ns2. – Add two new naetwork namespaces: # ip netns add ns1 # ip netns add ns2 The above commands create network space […]
How to change the default IP address of docker bridge
Question: what is the proper procedure to reconfigure the docker interface to use an address range (e.g., > 172.200) for the virtual interfaces it uses? You can reconfigure the default bridge network by providing the bip option along with the desired subnet in the daemon.json (default location at //cdn.thegeekdiary.com/etc/docker/daemon.json ) file as follows: # vi […]
“su: Authentication failure” – in Docker
The Problem In some situations, a normal user within a Docker container cannot run ‘su’ command to switch user. When ‘su’ command is issued, the following error returns. $ su – Password: [entering correct password] su: Authentication failure The Solution The sticky permission may be missing in /usr/bin/su within the container. With root privilege, you […]
How to Pause and Resume Docker Containers
Question: How to Pause and Resume running containers on docker host? This post will help to know about pausing and resuming any running containers on the Docker host. Let’s first start the docker container “memory_test” on the docker host. # docker start memory_test memory_test To stop the pause the docker container: # docker pause memory_test […]
How to find docker storage device and its size (device mapper storage driver)
Question: How to find the running docker storage device when docker is using the device-mapper storage driver and then check the size of it? 1. Please run the “docker info” command to display docker system-wide information which contains the docker storage info. # docker info Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 […]
Understanding “docker stats” Command Output
Question: How to monitor a running docker container performance metrics. For example, CPU,memory, I/O and network stats? The docker stats command can continuously report the basic CPU, memory, network and disk I/O metrics. For example: # docker stats a3f78cb32a8e CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS […]
‘docker images’ command error – “Permission Denied”
The Problem A regular user is not able list images using docker images command. Following error can be observed. user01> docker images Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.27/images/json: dial unix /var/run/docker.sock: connect: permission denied The Solution User is not part of docker group and doesn’t […]