Skip to content

Instantly share code, notes, and snippets.

@mausch
Last active February 26, 2024 14:22
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mausch/168d09d18e354c8e47981b8e44746af9 to your computer and use it in GitHub Desktop.
Save mausch/168d09d18e354c8e47981b8e44746af9 to your computer and use it in GitHub Desktop.
Run AWS WorkSpaces client on any Linux distro supporting Docker
#!/usr/bin/env bash
set -eu
dockerfile=$(mktemp)
trap "rm $dockerfile" EXIT
cat << EOF > $dockerfile
FROM ubuntu:bionic
RUN apt-get update && apt-get install -y wget gnupg2
# https://clients.amazonworkspaces.com/linux-install.html
RUN wget -q -O - https://workspaces-client-linux-public-key.s3-us-west-2.amazonaws.com/ADB332E7.asc | apt-key add -
RUN echo "deb [arch=amd64] https://d3nt0h4h6pmmc4.cloudfront.net/ubuntu bionic main" | tee /etc/apt/sources.list.d/amazon-workspaces-clients.list
RUN apt-get update
RUN apt-get install -y workspacesclient
CMD /opt/workspacesclient/workspacesclient
EOF
docker build -t aws-workspaces - < $dockerfile
xhost +
docker run -it --rm --name aws-workspaces \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v "$HOME/.aws-workspaces":"/root/.local/share/Amazon Web Services" \
-e DISPLAY=$DISPLAY \
aws-workspaces
@boutchaz
Copy link

boutchaz commented Sep 4, 2022

works like charm

@Ilnur786
Copy link

Magnificent

@sant527
Copy link

sant527 commented Sep 24, 2022

Hi I am not able to copy paste text in and out to the host and client

I am using ubuntu 22.04 as host

@samuelcolvin
Copy link

I got the following error when running the docker container:

(workspacesclient:7): Gdk-ERROR **: 13:01:02.958: The program 'workspacesclient' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
  (Details: serial 238 error_code 10 request_code 130 (MIT-SHM) minor_code 1)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
Aborted (core dumped)

Which was fixed by adding --ipc host, as suggested here.

@kcburge
Copy link

kcburge commented Oct 21, 2022

I found this script did not work for me. A few libraries were missing from the bionic image, particularly libusb. Also note the -t in the docker command requires this to be run with an attached terminal, which I have removed.

#!/usr/bin/env bash

set -eu

dockerfile=$(mktemp)
trap "rm $dockerfile" EXIT
cat << EOF > $dockerfile
FROM ubuntu:bionic

RUN apt-get update \
  && apt-get install -y \
    curl \
    gnupg2 \
  && curl -L https://workspaces-client-linux-public-key.s3-us-west-2.amazonaws.com/ADB332E7.asc | apt-key add - \
  && echo "deb [arch=amd64] https://d3nt0h4h6pmmc4.cloudfront.net/ubuntu bionic main" | tee /etc/apt/sources.list.d/amazon-workspaces-clients.list \
  && apt-get update \
  && apt-get install -y \
    liblttng-ust0 \
    libusb-1.0-0 \
    workspacesclient \
  && rm -rf /var/lib/apt/lists/* \
  && apt-get autoclean \
  && apt-get autoremove

WORKDIR /opt/workspacesclient

ENTRYPOINT [ "/opt/workspacesclient/workspacesclient" ]
EOF

docker build -t aws-workspaces - < $dockerfile
xhost +local:
exec /usr/bin/docker run -i --rm --name aws-workspaces \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -v "$HOME/.aws-workspaces":"/root/.local/share/Amazon Web Services" \
  -e DISPLAY \
  aws-workspaces

@MattTYXM
Copy link

MattTYXM commented Feb 8, 2023

Hi I am not able to copy paste text in and out to the host and client

I am using ubuntu 22.04 as host

See Enable or disable clipboard redirection for PCoIP

@mausch
Copy link
Author

mausch commented Feb 9, 2023

FWIW I now use Nix instead of Docker to run this. e.g.

NIXPKGS_ALLOW_UNFREE=1 \
nix --extra-experimental-features 'nix-command flakes' \
shell --override-input nixpkgs nixpkgs/bc9d72b9dcdda848c122a295ed45054f27adf6f2 --impure github:guibou/nixGL \
github:nixos/nixpkgs/bc9d72b9dcdda848c122a295ed45054f27adf6f2#aws-workspaces -c nixGL workspacesclient

@crocodile-coder7
Copy link

Any luck getting this working with the WSP version?

@mausch
Copy link
Author

mausch commented Dec 6, 2023

Any luck getting this working with the WSP version?

For the Nix package, it's being worked on at NixOS/nixpkgs#251976 .
For this Dockerfile, I'm not planning to maintain it any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment