This has bugged me for years – with random success depending on sudo, su – etc.
The proper solution:-
steve@studio:~$ ssh -X 192.168.0.201
Last login: Fri Feb 10 21:54:11 2017 from 192.168.0.247
[steve@fleabox ~]$ xauth list
fleabox.track3.org.uk/unix:12 MIT-MAGIC-COOKIE-1 b4339e07fb0e4febdde6128fc56419e4
[steve@fleabox ~]$ sudo su -
[sudo] password for steve:
[root@fleabox ~]# xauth add fleabox.track3.org.uk/unix:12 MIT-MAGIC-COOKIE-1 b4339e07fb0e4febdde6128fc56419e4
[root@fleabox ~]# virt-manager &
[1] 7168
Success!
mkdir -p dockerfile/C7httpd; cd dockerfile/C7httpd
vi Dockerfile
FROM centos:7
MAINTAINER "Steve Netting" steve@netting.org.uk
ENV container docker
RUN yum -y --setopt=tsflags=nodocs update && \
yum -y --setopt=tsflags=nodocs install httpd && \
yum clean all
EXPOSE 80
ADD run-httpd.sh /run-httpd.sh
RUN chmod -v +x /run-httpd.sh
CMD ["/run-httpd.sh"]
vi run-httpd.sh
#!/bin/bash
# Make sure we're not confused by old, incompletely-shutdown httpd
# context after restarting the container. httpd won't start correctly
# if it thinks it is already running.
rm -rf /run/httpd/* /tmp/httpd*
exec /usr/sbin/apachectl -DFOREGROUND
docker build .
docker images
docker run -d -p:8082:80 steve/httpd:latest
docker ps
curl http://localhost:8082
... If you can read this page it means that this site is working properly ...
To start interactive shell from inside running container:
docker exec -i -t romantic_noyce /bin/bash
Only A̶m̶i̶g̶a̶ Linux Makes It Possible